Please note: Adafruit has an updated version of this switch. We currently have a limited number of the original version. If you are concerned about which version you may receive, please contact us!
This sensor is essentially a reed switch, encased in an ABS plastic shell. Normally the reed is 'open' (no connection between the two wires). The other half is a magnet. When the magnet is less than 13mm (0.5") away, the reed switch closes. They're often used to detect when a door or drawer is open, which is why they have mounting tabs and screws. But these also have a sticky-foam-tape back so you can also place them in locations you can't attach with screws.
Revision History: As of June 2, 2021, Adafruit sells these with premium wire ends for easy breadboarding.