(fucking magnets signals, how do they work?)
Because my most recent playing-style means I rarely
use signals, I'm not sure I'm referring to how OTTD does it, but original TT's signals worked (roughly) by treating any stretch(es) of track between two signals as a "one train only" area. If a train on an adjacent stretch approaches a signal bordering a train-occupied stretch (which might include any amount of complex junctions within it, around which an unfettered train could easily avoid the other engine and its cars), it gets a red light and isn't allowed to enter until it's vacated.
It's quite possible to engineer a deadlock situation, but usually by using two
few signals on the line (where a double-width line has cross-overs, set signals up on each (parallel) 'single-width' line segment, rather than put signals before and after the cross-over so as to include both lanes, for example).
I avoid it by making dedicated lines with (even) dedicated station-platforms (an intermediate production resource might have a station with two platforms, one to receive the line inwards from its source-resource, the other connected only to the line that goes out to where its own production is appreciated as a receipt... But if that gets too complicated, or you want more (for example) forests-sourced lines leading into a wood-processing resource's station than you can actually extend the platforms out to, then merge them and put signals on each relevant line immediately open-side of the merge.
But, despite what I posted recently, I
haven't yet played the latest version of OTTD, so this is from memory and (mostly) original-TT as well. Things may have changed
so much...