One big advantage of a steam engine is its robustness - there had been a few occasions where steam trains had been put back into service, because it was too cold for Diesels.
Steam engines are generally weaker than Diesels and far less effective - a 600 hp diesel shunter can pull what a 2000 hp steam engine would not get moving. But the differences start when the train is running.
Also, contrary to what you might expect, a steam engine has fewer moving parts than a Diesel engine. Their tear and wear characteristics are very different.
But the limitations of the technology are pretty much explored. Even condenser engines did not improve the efficiency a lot.
---------- Post added at 09:10 AM ---------- Previous post was at 08:57 AM ----------
only the war kept steam going for another 2 decades or so.
In eastern Germany, the last steam engine was retired from regular service in 1988. This had purely economic reasons. The oil crisis of the late 1970s hit eastern Germany especially hard and made it retire oil-fired steam engines in favor of coal-fired steam engines.
In 1974, one third of all trains in eastern Germany had still been propelled by steam (In 1965 it was 88%)
You have to include there: Because freight trains had a higher priority over passengers trains in eastern Germany, it was nearly impossible to operate with time tables over longer distances. A steam engine pulling a long-distance high-speed (120 km/h in Eastern Germany) train was not uncommon. Even updating the tracks to 160 km/h proved impossible in the Eastern German socialist economy.
Much worse: Because they used the wrong sand for making concrete cross ties in the seventies, the average speed was much lower because a large number of tracks was damaged and had to be repaired...
In western Germany, the last steam engine retired in 1977, the famous Class 103 electrical trains had already been doing the long-distance passenger transports then.