Rail junctions fall into two main categories: flat junctions and grade-separated junctions.
Flat junctions do not involve any tunnels or bridges, so they are cheap to build and thus very common in real life. They are, however, much less efficient because train paths intersect frequently, meaning they have to wait for each other.
Grade separated junctions allow for much better traffic flow because the tunnels or bridges allow trains to cross paths without stopping. However, in real life these are much less common and only used in places where the traffic warrants it.
While many OpenTTD players prefer to jump straight to grade-separated junctions for the increased throughput, in the aesthetic realistic JP+ style of gameplay we will favour flat junctions for realism.
Flat Junctions
When building flat junctions, it seems easy to just connect your tracks in a way that works. Here is a simple single track branch connecting to a double track mainline. But this isn’t entirely realistic and should be avoided if you have the space:

Build a short section of parallel track before the merge, and split the “double slip” switch into two separate ones, separated by a tile of plain straight track. This gives a visual indication that this is an assembly of multiple switches, as is often used in real life because it’s cheaper. Double slip switches can be used when space is tight, however.

Note:
This design will slow your trains down to 111km/h because it counts as a 1.5-tile curve - see Curve Radius. Trains slowing down for switches gives an extra layer of realism, however.
Once we upgrade to double track, it’s fine to just do the obvious thing. Here, the double slip switch isn’t actually a switch, just a simple crossing because trains don’t change track sides here.

Basic Flyover
The flyover is the simplest type of grade-separated junction. It works well, but this example is very large because we’re following the branching track has to loop out and cross the mainline perpendicularly. Plus we’re following Aesthetic Railway Design which makes it sprawl even further:

We can save a huge amount of space by splitting the height of the mainline, either with a bridge or a tunnel, to allow the branching line to connect more directly:

If you need to go in all directions, this is easily expanded by adding a spur with two more flyovers to create a 3-way stack interchange:

Note:
4-way junctions are not recommended, because there are practically no natural situations where trains would need to go to and from all directions. Consider building two 3-way junctions instead if required.
Hybrid Junctions
Hybrid junctions combine elements of flat junctions with some grade separation. They are useful if you have a large amount of trains flowing in one direction, but only occasional traffic in the other direction.
Here we have a grade-separated flyover in one direction, while the other direction is connected only by a single-track spur suitable for low traffic:

This can then easily be upgraded into a double-track spur if required, and eventually given flyovers to become a full-fledged stack interchange.
