A reed switch is a device with two inner contacts that closes the connection between the contacts when a magnetic field is applied. This is similar to a standard momentary push button, except you apply a magnetic field to close the switch instead of pushing a button!
Reed switches are very inexpensive if you purchase the typical "normally open" option. That means that without the presence of a magnetic field, the contacts are "open," hence no current will flow through the switch. There are "normally closed" switches out there, but they very expensive compared to the normally open option.
I needed a simple way to turn strings of LEDs on and off in an automated cabinetry lighting project and didn't want to over complicate my design with additional components such as transistors and pull up/down resistors, so I figured out how to actuate a reed switch in reverse. By fixing one magnet in a permanent position behind the reed switch, it will keep the switch and the connected LEDs on. However, bringing a second magnet near the switch (such as one fixed to a cabinet door), the magnet field of the fixed magnet is opposed, opening the switch once more and turning off the LEDs.
There are a few caveats. The polarity of the two magnets is very important. Rather than try to explain why, I will just suggest you place one magnet, and then test with the second. If it doesn't turn off as you bring the second magnet close, flip the second magnet over and try again. Secondly the distance of the magnets to the switch should also be considered. If the fixed magnet is too close to the switch, the second magnet will have to get just as close (or closer) to oppose it. Fix the first magnet just close enough to turn the switch on, and there shouldn't be a problem with the spacing of the second magnet.
The orientation of the switch itself could also pose an issue. Look closely at the contacts inside the glass housing. The magnets should be applied to the sides of the contacts, not gap in between Lastly, many of these reed switches come in a glass tube which can be fairly fragile. Handle it with care and don't be too aggressive when bending the leads or you may end up breaking the switch and getting shards of glass in your fingers.
While I was working on this project, I found this website which has a lot of other tips concerning reed switch actuation: