You can, Japan does it and they are considered best in the world. There are at least 10 different train companies in Tokyo, (probably more like 20 but I don't know all the smaller ones). Similarly in Osaka, Kyoto, etc....
> Rail should be a public service.
No, it should be run for profit but the system put in place well designed so serving more customers better means the company does better.
Japan accomplishes this AFAIK, by letting the train companies buy/own/build other things. For example, the Tokyu company that runs some of the trains that come into Shibuya station owns the building Google's Japan office is in. They also own the famous 109 building (10 = to, 9 = kyu). And 10 or 15 other buildings in Shibuya. They run grocery stores at probably 50% of their stations. They also build apartments.
If their line gets sucky people spread the word "don't live on that line, it sucks, it's too crowded and the trains are late" and all their business suffer and people start moving out. So they have an incentive to keep their lines better than the other lines.
They also compete on destinations. For example Shibuya to Yokohama. You can take a Tokyu line and you can also take a JR line. They go slightly different routes but end up at the same place. Similarly if you're in Kyoto and want to go to Osaka. You can take JR, or Hankyu, or Hanshin, 3 separate train companies all of which run multiple lines. You'll see ads for the multiple different competing trains to get you from downtown Tokyo to Narita and Hanada airports.