The distance between trains is maintained by a combination of driver checks, equipment that detects train positions, signals, ...