If you’d like to take a look at how one of the older Victorian mechanical signal boxes on this map (still) work, I can wholeheartedly recommend Tom Scott’s recent video on signalling in Britain [1].
[1]: https://youtu.be/omYfLDlt-MA