I've been reading up on American railroad history lately and one thing I particularly noticed (amongst other places, detailed here) is that many American railroads retired their electric trains in the 1970s and went back to diesels. Why is this?
There's a bit of the way you phrase it in there that sort of reveals part of the reason. You called it "back to diesels". But diesel locomotives themselves are newer than electrified railways, and the widespread application of diesel locomotives is substantially newer.
First off, the railroad referenced in the link you linked, the Milwaukee Road, is a member in the (relatively small) group of mountainous freight railways that were previously electrified in the US. The other that comes to mind is the Virginian, but I believe there were a handful of others. These were electrified in the early 20th century, before widespread dieselization, and replaced steam locomotion.
The economics of steam and diesel locomotives are very different. Generally diesel locomotives were economically superior to steam, which is why they eventually won out. For a particular line, while electric locomotives might've been superior to steam, they might not've been superior to diesel. Steam locomotives are incredibly maintenance-intensive, whereas diesel locomotives are much less (and electric ones even less than that). But, the electrification equipment is also very expensive to build and maintain, which limits its usefulness to lines with very dense traffic. Since this keeps electrified networks small, it also means that electric locomotives are limited in terms of where they can go, and that fleet incompatibility limits the maintenance advantages of electric locomotives.
Besides the relative maintenance costs of locomotives and overhead wires, another issue is that many mountain railroads used electric locomotives for their additional power over steam. As diesel locomotive technology got better, this advantage was eliminated. Another issue that previously gave an advantage to electric over steam was smoke in tunnels. Diesel locomotives still produce fumes, but the layout of the locomotive means that the crew is much less exposed to them, and a properly operating diesel locomotive is generally much less smoky than a steam locomotive. A properly operating steam locomotive at speed is about as smoky as an Alco, a diesel locomotive with a reputation of smokiness when starting up. A diesel locomotive can be very smoky is something goes wrong, but steam locomotives can be extremely smoky too. Steam locomotives can burn clean too, but in general, they're smokier. The only advantage of electric became cheaper locomotive maintenance and power, which was negated by incompatibility with the rest of the network and maintenance of electrification systems.
The only other de-electrification I'm aware of is the NYNH&H de-wiring the line from Norwalk to Danbury Connecticut. This line was part of a much broader category of electric commuter railways, where dense traffic and frequent stops gave electric locomotives the edge over steam. Plus, they were required for operating in the tunnels into New York City. Again here the electric locomotives replaced steam. In general suburban electric railways in the US are still in use today. The NYNH&H de-electrified it because a particular diesel locomotive, the FL9, could be powered by a diesel engine or third-rail DC electricity, which meant that it could connect non-electrified lines to the electric-running-required tunnel to Grand Central Terminal in NYC. This removed an advantage of electric locomotives. The railway was broke and didn't want to pay for the upkeep of the electric traction systems, and wanted the scrap value of the overhead lines, which was somewhat significant. They actually planned a more comprehesive de-electrification than that, but fortunately it never got very far. It's also not clear it would've saved them very much money, management had run the railroad into the ground.
The actual extent of railway electrification in the US was never very large. A relatively small amount of electrified trackage was removed, mostly because the reasons for it to exist in the first place applied better to steam locomotives than diesel ones. But there never was a big electrified network in the US outside the northeast in the first place, and the northeast is where it still exists. Electric railways were never in favor in the first place, the size of American railroads made it simply too expensive to be worthwhile. What happened in the mid-20th century is that the cases where electrified railroads were preferred got smaller for various reasons because of the development of diesel locomotives, but in general electric locomotives were never used very widely, and where they were used widely they are still used.
Given your spelling of "favour" I would guess you're British, and might be coming at this from the perspective of British railways, which are much more electrified. Something important to note is that the UK switched from steam to diesel much later than the US. When you've got lots of steam locomotives electrification is a lot more beneficial than if you've got diesels. Part of it also is scale. The US has relatively few passenger routes with lots of stops that would particulary benefit from electrification (and where the US does have this, railways are often electrified, but again this was when diesel was not really an option). It also has a lot of extremely lengthy main lines, so to start getting a really good electric railway network you need to spend enormous amounts of money to electrify huge lengths of track, that simply wasn't worth the relatively minor advantage in many cases.