John....
The Western Union originally built most of the telegraph pole lines along the railroads in the western part of the US when the railroads were originally under construction. It was actually a good deal for both the RR companies and the Western Union because it gave the RR telegraph service in exchange for right of way so the WU could access lots of places with their own wires where it wouldn't have been (profitably) able to do so otherwise. Railroad operators usually handled The Western Union wire on a commission basis determined by how many messages they handled, in the smaller offices in the depots along the railroad.
While this arrangement was in place, the telegraph operators (and wirechiefs at main relay points) did the line testing when things failed. If a wire went "open", the practice was to use the station's switchboard and temporarily patch a "ground" connection on the wire on each side of the office to determine in which direction from that office the break was, and then alert the Western Union lineman responsible for the district as to the findings, and start him out looking for the trouble. A wire that was broken, shot down, or burned down by lightning was soon found and spliced back together to return it to service. If a wire went "grounded" (still worked, but some stations along the line couldn't work others past a certain point), the test was similar, except the wire in question was momentarily "opened" by the operators sequentially along the line at the request of the wirechief from one station to another until the "open" test couldn't be observed any longer by the testing station/wirechief. This showed where the ground fault was between two stations, and then the WU lineman would be dispatched to that area to find and clear the fault.
In the absence of a lineman, sometimes the operators themselves ended up with the duty of riding or walking the line to find and repair a break or remove a ground if they could.
In instances of major line damage such as rock, snow or mud slides, wildfires or floods, and that sort of thing where the entire line was damaged and poles knocked over or destroyed, etc, the nearest Western Union line gang outfit would be brought in to do the line rebuilding.
As the Western Union began getting out of the physical plant end of the business (Circa 1950-1960) the telegraph lines and equipment on the railroad property were generally sold to the railroad company for "a dollar" and from then on, the line and equipment maintenance was up to the railroad company proper, and their own communications or Telephone/Telegraph departments. Most railroads took over and handled troubles the same way that the Western Union had previously, sometimes using Maintenance of Way forces if necessary to take care of the problem. This was the case on the D&RGW when I worked there in the Comm Dept 1965-73.