Although simulating the operation of an extensive railway network would seem like quite an obvious thing to do with your computer, there aren’t many programs that really allow you to do this.
Bahn
Bahn is a shareware program written by Jan Bochmann. After many years as one of the classic dos programs, it finally made the big step to Windows a little while ago, but a dos version is still available.
It was intended in the first place as a tram network simulator, and it is great for modelling complex tram or metro systems with hundreds of trains. Because the model avoids most complications, it runs very fast. Its main drawback is the lack of a realistic signaling system, which rules it out for serious modeling of mainline railways. Trains run automatically, so there’s not much fun to be had once you’ve completed the model, but in practice you can spend many happy hours tinkering with a network to get it just the way you want it.
Rail3D
Mark Goodspeed started work on Rail3D a few years ago with the intention of making something like Bahn, but with better signals. That goal was achieved long ago, but the project continues, adding proper 3D graphics, the possibility to drive your own train in cab-view, signal panels, and even - for a while - an economics module that allowed Rail3D to be used in a multiplayer strategy game.
Rail3d on this site; Official Rail3d site
Vlakosim
This Czech freeware program, by Jan Prochazka, is essentially an open-source version of Transport Tycoon “without the money”, but with OpenGL 3-d graphics. Quite fun to have a play with, but still relatively undeveloped. Like Bahn and all Transport Tycoon clones, it is hampered by the square grid.