How does a limit switch work?

Extra: how can I use one to detect whether a gearbox switched gears successfully or not?
3 answers 3