The simplest circuit protection device is the fuse. A fuse is just a thin wire, enclosed in a casing, that plugs into the circuit. When a circuit is closed, all charge flows through the fuse wire -- the fuse experiences the same current as any other point along the circuit. The fuse is designed to disintegrate when it heats up above a certain level -- if the current climbs too high, it burns up the wire. Destroying the fuse opens the circuit before the excess current can damage the building wiring.
The hot wire in the circuit connects to the two ends of the switch. When the switch is flipped to the on position, electricity can flow from the bottom terminal, through the electromagnet, up to the moving contact, across to the stationary contact and out to the upper terminal.
The electricity magnetizes the electromagnet (See How Electromagnets Work to find out why). Increasing current boosts the electromagnet's magnetic force, and decreasing current lowers the magnetism. When the current jumps to unsafe levels, the electromagnet is strong enough to pull down a metal lever connected to the switch linkage. The entire linkage shifts, tilting the moving contact away from the stationary contact to break the circuit. The electricity shuts off.
Click on the circuit breaker to release the switch.
A bimetallic strip design works on the same principle, except that instead of energizing an electromagnet, the high current bends a thin strip to move the linkage. Some circuit breakers use an explosive charge to throw the switch. When current rises above a certain level, it ignites explosive material, which drives a piston to open the switch.