I'll try my best to explain these, but feel free to ask for clarification

1) Enable a faster train to overtake a slower train
Situation:
For this situation, I'm going to assume that the train behind is at least as fast as the train in front. Take a single track line, with a faster train behind a slower one.
Create a setup which allows the faster train to overtake the slower one. Basically, it's a priority but checking BEHIND the train on the same line. The idea is that for any train, if there's a train behind it, divert into a side-line where it will wait until the train behind has passed.
Problem
The difficulty being, that if there are 3 trains in a row, the second train will also try to divert into the side line. To solve this, the train must only PREFER the side line over the main line if the line behind is occupied. I've got it working for two trains, but I can't avoid a deadlock if 3+ trains arrive consecutively.
2)Simulate "splitting" of trains at a station
Okay, this one's slightly trickier.
Situation:
Assume, for argument's sake, a small station - there's no need to expand this into a large station with multiple options.
Take a three platform station, two platforms are 3 tiles - the other 6 tiles. Three trains are involved with this operation. Two 6-car (3-tile) HSTs, and one 12-car (6 tile) HST - the longer train being the supposed combined train.
The aim is to copy the real-life situation where two trains from different lines combine into one train.
Real World Example:
On the west coast main line, First Transpennine Express runs services from Manchester to various destinations. A large number of these services (to Barrow, Windermere, Blackpool, Glasgow and Edinburgh) all travel up the west coast main line. To send the trains individually would be pointless, requiring more drivers and more "paths" (blocking other traffic) In reality, these trains are often run two or three together as one unit, splitting en route. Eg the trains for Blackpool and Glasgow may travel together from Manchester to Preston as a 6-car unit, at which point they split into two 3-car trains, one to Blackpool and the other to Glasgow. Similarly the Barrow and Windermere trains may split at Carnforth or Lancaster, the Glasgow and Edinburgh trains may split at Carlisle. The point being, that for a portion of the journey it is run as one large train, rather than multiple smaller ones, simplifying signalling requirements and allowing more trains to pass through a section of line.
Problem:
Well, it may be easy, but I can't get this to work at all. Essentially the problem should be quite simple - the train at any one platform can leave if, and only if, both of the other two ARE occupied. For the sake of argument, I assume that all platforms are bays (leaving the back of the platform available for signalling using monorail/maglev) but I can't get it working properly.
So, can any smarter man then I manage either of these problems?
Feel free to use absolutely any trick of tracks, stations, waypoints, signals and objects to accomplish them, although the ability to use tunnels to hide the "logic" away from the track would be a bonus
