Lines were electrified in the past, some successfully, some not, like the milwaukee road. In the end I suspect it came down to the cost of maintaining the electric infrastructure was more expensive than the diesels that replaced the old steam engines were. Some lines remained electrified, like the old Penn mainline (now the route basically of the Amtrak NE corridor), because there were practical reasons to do so, including having long tunnels where steam or diesel engines can't operate safely.
Electrification is common on commuter length railroads, the engines are a lot quieter than diesels so residential areas are less complaining and electrified railroads also can be a lot faster than anything pulled by a diesel (high speed trains are I think all electrified).
Electrifying trains sounds like a panacea, but there would be a huge cost with it (as with any electric vehicles using the grid). To do that would require a true national power grid I think, something that almost no one seems to be thinking of or working on (there is no such thing; electricity has at best regional grids), for the very reason of making sure there is enough power to power the trains. A true national power grid, that is redundant (similar to the internet is), is prob something we should be doing, but that is another story, not really for this forum.
Then you have the massive infrastructure, which likely would be overhead power rather than something like a third rail, the investment would be hugeNot just the overhead wires and the poles to support them, but then there will be substations along the way that have to bring in power and step it down to what the trains use. That kind of overhead power is very subject to weather and other problems, like a truck driving into them or some drunken fool. Trains running overhead pantographs can in certain circumstances catch the wire and tear it down (used to happen a lot on the Metro North New Haven Branch, happens with Amtrak as well several times a year). It would be a massive investment I just don't think anyone would be willng to pay for,even if let's say the government decided to pay for the infrastruture and/or make it worthwhile, the railroads would turn it down because of the fear of cost of maintaining it.
China has done it with their high speed rail because there was a will to do it and the government there felt it was important for their future, same way Europe did it. Even so, China has limited it from what I know to certain corridors, and I think it is only passenger.
I didn't read the original piece, but India is probably doing it because they have a huge population and they figured in the long run it would work better than standard diesels. For one thing, they could possibly be thinking of developing high speed rail, in a country where a relatively small percent of the population have a car or could have access to fly.
Yes, cities and towns had a network of things like trolleys and interurbans and they worked. The thing is, they weren't always economically viable, from what I have read even in the heyday, before let's say the 1930's, they were kind of hand to mouth. Many of them developed amusement parks and the like at the end of the line to create traffic on the weekends. Keep in mind this was long before there were government subsidies and I suspect with that, some of the interurban lines could have made it, there was enough demand and might work between bigger towns. What really killed the interurbans was the automobile, why take an interurban when you could drive? As highways and roads were built, it just no longer made sense.
Trolleys died for a lot of reasons. Some of it was just plain downright criminal activity, in other cases urban planners felt (wrongly IMO) that they needed to allow car traffic and trolleys were in the way of that....not to mention they had the ear of "urban planners" (often literally in the pay of bus makers like GM) telling them that that buses were the answer to their problems; ya think that wasn't conflict of interest? Not to mention outright bribes). Some of the downsides of trolleys, like overhead wire or problems with cars could have been dealt with. Even in a transit dense city like NY, Trolley's could have helped with areas not serviced well by the subway. Unfortunately, as many cities have found, re-establishing light rail isn't easy.
I suspect the only way mass electrification would happen is if it was part of a solution to a major crisis situation , that is how big things tend to happen here in the US.