Tail lights, like any other electrical system is a simple circuit, when the brakes are disengaged the circuit is broken, when you push the brake pedal it hits a switch that completes the circuit, turning the lights "on".
By send battery power though the wires to the tail light bulbs. This is done by completing the circuit through the headlight switch or the brakelight switch. This makes them light up by energizing the filiment.
At it's basic form, the brake system in a car is just a simple switch. There is a switch attached to the brake pedal assembly. The light circuit remains broken until the switch is depressed. Once pressed the circuit is completed and power is routed to the tail lamps which light up.
Well attached to the brake pedal is a switch. When the brake pedal is up the switch is closed. When you press on the pedal the arm swings down and the switch is activated. This then sends power to the brake light bulb and it illuminates.