In Simutrans the ways allow vehicles to go from a place to another place with goods or passengers.
Select in the train toolbar a rail, your magnifying glass cursor will whange to a rail shaped cursor :There are two ways to build a rail section : you can click on the starting point and click to the arrival point to make the game build the rail itself, you can also click and drag to see the trajectory of your rail. If the starting point is the same as the arrival one, no rail will be constructed.
To build a rail section from an already existing one you just have to click on the wanted part of the existing rail section as starting point. Now you can build your ways as you wish and especially as you need.
You can see informations about a way (or any other tool) by letting you cursor over an icon a second, informations of the way will appear : the price of a way unit, the maintenance cost of a way unit and the max speed the way can support. You have to take care of these informations to build a network well : don't use a high speed way for slow vehicles for example.
No way but roads and canals allow vehicles to pass in opposite directions simultaneously.