Other countries (e.g. Britain) share most tracks between passengers and freight, and therefore need to maintain the track to a very high standard, and run freight trains at a much higher speed than is seen in the USA. (e.g. 80km/h or 55mph for a coal train isn't unreasonable, or 120km/h = 75mph for a container train)
* Upgrading signalling systems at technology progresses.
The latest systems use in-cab signalling, so the driver can't fail to see a signal due to fog etc, and the train's computer is aware if a signal is missed and will stop the train. (These systems are decades old, but I've read that they're not common in the USA. It took a couple of major accidents in the UK for them to be installed.) [Search ETRMS rail, or in-cab signalling].
GSM-R, i.e. the railway version of the original European mobile phone system, provides a big red button. If pressed, all trains in the area are immediately stopped. A driver would press this if the train is expected to crash, or has crashed. That can stop an oncoming train on the opposite track. [Search GSM-R]
* Maintaining the track to a high standard
Running a measurement train [1] over the whole rail network regularly, which accurately measures "the track geometry and other features such as overhead line height and stagger, and the track gauge, twist and cant". Changes in this can show where maintenance is needed much earlier than a visual inspection, and the data can be inspected retrospectively if there is a problem.
Machine learning is probably the newest/next step for this [2].
* Thoroughly investigating any accident or "near miss"
An independent group [3] investigates accidents, with the aim of preventing future accidents rather than assigning blame. The most recent report [3A], for example, finds problems with project management and recommends, "Network Rail should review its project assurance process as applied to the CASR scheme". The depth of these investigations is comparable to most western countries' investigations of aircraft accidents.
Investigations like this are what leads to posters in stations saying "don't run down the stairs" or "mind the gap" announcements. Falling down escalators or under a train in a platform is much more likely than being involved in a crash while a passenger on a train.
[1] https://en.wikipedia.org/wiki/New_Measurement_Train
[2] http://www.vision-systems.com/articles/print/volume-20/issue...
[3] https://www.gov.uk/raib-reports
[3A] https://www.gov.uk/raib-reports/serious-irregularity-at-card...
Every single freight train that goes by has at least fifty cars, and they roll all night....
Try to imagine what the market is like for intercity transportation that is more expensive than driving or taking a Greyhound and yet more than twice as slow, and doesn't connect you to an effective intracity transportation network once you arrive. There weren't many passengers.
Rail transportation is very important in the US, but it's all for freight, which takes up a similar proportion of rail as passenger does in other countries.
Amtrak does run some profitable passenger rail lines in the US, including some places you wouldn't expect, like the Oklahoma City-Dallas line IIRC. There is an interstate connecting those cities, and the population density isn't exactly really high there so IDK.