In addition to the other tips here, I recommend having a two level rail system with one direction heading on one level and the opposite direction on a level above.
The pro is this way you don't have to worry about making intersections that cross over your main rail lines.
The con is that you have to build enough space to ramp up your track connections on level 2 but that's mitigated by just having around 2 train lengths of space length of space from the main rail before the train station
So it looks like this from the side
==========> Rails
---------------------- One meter foundation
At least 8 meters of space
<=========== Rails
----------------------- One meter foundation
Yeah that tripped me up for a bit too. I colored my 1 m foundations so the top was Red for towards my home base and Green was for away. So I could follow the IALA region b red right returning guidance
I also use two blueprints for my rail construction that I alternate with to help make things flow
that has rails and rail signals built in
one that's just foundation