A magnetic switch is just like a light switch: it turns a circuit on or off depending on what position the arm of the switch is in. The only difference is that a magnetic switch is operated by a magnet, rather than your fingers.
A magnetic switch has an arm of conductive metal that is fixed on one end, two switch contacts that are near the free end of the arm, and a movable magnet. Some also have two magnetic clamps.
There are three types of magnetic switch. Normally open monostable switches remain connected only when the movable magnet is near the arm. Normally closed monostable switches remain disconnected only when the magnet is near the arm. Bistable switches change position from open to closed whenever the magnet moves, but remain in their last position even when the magnet moves away.
How They Work
When the movable magnet comes close enough to the free end of the arm it attracts the metal arm to it. This brings the end of the arm into contact with (or away from contact with) the switch contacts. Bistable switches have magnetic clamps that hold the arm in place after the magnet moves.