BOT switch is mounted behind the brake pedal in such a way that in normal conditions, when the brake functions well, the pedal doesn’t touch the switch. It is almost about to touch the switch but doesn’t touch it.
Now, in case of leakage of brake oil, or if there is air in the system, the brake pedal would get pressed more and go all the way down to hit the BOT switch.
When the BOT switch gets pressed, it shuts the engine off. Thus the vehicle happens to stop.