A railway signal is like a traffic light that tells the train when to go and when to stop. There are many different kinds of signals, just like there are many different kinds of traffic lights.
When a train approaches a signal, it reads the signal's light color, just like a driver reads a traffic light's color. If the signal is green, the train is free to proceed. If the signal is red, the train must stop and wait until the signal turns green.
Sometimes a signal will show a flashing yellow light or a double-yellow light. These are like cautionary signs that tell the train to slow down and be careful, just like a driver would when seeing an amber traffic light.
Signals are very important for keeping trains safe and making sure they don't run into each other. That's why they are placed all along the railway track, at every intersection and junction.