With a buzzing noise? You're too close to a train infront, if you're quick enough you can press T or something to stop it, or just slow down a bit..
Not always, in most trains (apart from Steam) there is an alerter that rings when you're about to pass a signal or similar, if you don't press the Acknowledgement button to say you are aware of the danger/signal/change ahead the emergency brakes will apply automatically to stop the train. When you pass over the alerter "block" on the track, and the buzzer sounds, press the button to say you have seen the signal or danger.
I hope that makes sense, I worked this out a while ago, and adds more realism to the game.