There were a number of advances to the Corliss engine made before the end came. Higher pressures were used. Some advanced locomotives were using 800-1000 psi superheated steam. Locomotives were "compounded", where the steam leaving a high-pressure cylinder would enter a low-pressure cylinder. The Uniflow engine was invented and entered widespread use. However other technologies surpassed the reciprocating steam engine, and the end was near.
At sea, the handwriting was on the wall after the steam-turbine powered "Turbinia" made an appearance. She was capable of 34.5 knots (about 39 miles per hour). I will turn the rest over to Wikipedia:
Turbinia was the first steam turbine-powered steamship. Built as an experimental vessel in 1894, and easily the fastest ship in the world at that time, Turbinia was demonstrated dramatically at the Spithead Navy Review in 1897 and set the standard for the next generation of steamships, the majority of which were turbine powered.
Parsons' ship turned up unannounced at the Navy Review for Queen Victoria's Diamond Jubilee at Spithead, on 26 June 1897, in front of the Prince of Wales, Lords of the Admiralty and foreign dignitaries. As an audacious publicity stunt, the Turbinia, which was much faster than all other ships of the time, raced between the two lines of large ships and steamed up and down in front of the crowd and princes with impunity, while easily evading a Navy picket boat that tried to stop her, indeed, almost swamping it with her wake.In the automotive world, internal-combustion gasoline engines were far more practical and efficient than gasoline-heated steamers. Internal combustion engines have the advantages of requiring no pre-heating and very little maintenance. For fun, below is a picture of a Stanley Steamer 6 HP engine. I would imagine it would take a fair amount of time to boil water, then heat the cylinders enough that steam wouldn't immediately condense in them.
On the rails, the end came a couple of decades later. Diesel-electric locomotives began replacing steam locomotives in the 1930's. Initial diesel-powered locomotives had been a disappointment. Diesels operate at low speeds, so a heavy transmission and clutch was needed to adjust the speed of the train. Eventually a design was developed where the diesel engine was connected to an electrical generator, and each wheel of the locomotive was attached to a motor.
A pair of late-model steam locomotives (steam locomotives were often custom-made, with no two exactly alike):
Steam locomotives, by comparison, require intensive maintenance, lubrication, and cleaning before, during, and after use. Preparing and firing a steam locomotive for use from cold can take many hours, although it may be kept in readiness between uses with a small fire to maintain a slight heat in the boiler, but this requires regular stoking and frequent attention to maintain the level of water in the boiler. This may be necessary to prevent the water in the boiler freezing in cold climates, so long as the water supply itself is not frozen.Another useful feature of diesel-electric locomotives that might not be apparent at first glance is that one train crew can operate several locomotives. If you need several steam engines to move a train, you will also need several crews.
Below is a diesel-electric streamliner design built in 1936. I love the big radiator grille!
Union Pacific M-10000 and Burlington Zephyr, both Diesel-Electric.