If trains are all on time and running perfectly, then there would be no need for signal lights. Unfortunately, problems happen, and the signal lights warn the engineer of potential dangers.
The signal lights will also show the engineer which track he should be on, especially when entering or leaving a station.
There are two types of signals that are used by the railroads: permissive and absolute. Permissive signals give the engineer a choice on whether or not to go, but absolute signals need to be followed no matter what.
A semaphore resembles a small tower with lights in pairs on it. The lights that signal the engineer are on the semaphore.
If one light is covered and the other is green, it means that the track is clear and to go. A red light, which is absolute, means to stop.
Sometimes both lights show. Green over red instructs the engineer to slow down and be ready to stop at the next signal. Red over green also warns to be ready to stop, but the train will be able to go after stopping.