A deadlock is an unstable situation in a railway network where multiple trains are blocking each other such that neither train can continue. Deadlocks should be avoided at all costs, but are sometimes hard to foresee. In case of a deadlock, the placement of signals is most likely not optimal.
Solving a deadlock situation
In some cases, you can solve a deadlock just by adding some additional signals. It is advised to stop all trains around a signal when doing a lot of signal changes, to avoid collisions. Sometimes you can make some additional room by adding some track.
In more severe cases, you need to move trains manually by giving them permission to pass a red signal. Stop the train manually, so that it does not collide with the train in front (as the train is not protected by the signal any more). Repeat for other trains to make gaps as small as possible and create room where needed. It is useful to stop trains trying to enter the deadlock situation, to avoid even more trouble.
Once a deadlock situation is resolved, you should seriously reconsider your track layout and signal placement. Removing level intersections and replacing those with bridges or tunnels also helps avoiding a new deadlock in the same location in the future.