"Limit switch also known as micro switch. In CNC, 3D Printing and RepRap Printers these switches are used as End Stops and to detect max and min limits of axis.
Mechanical switches are simple to use and cheaper than optical endstops because they do not require a circuit board and only use 2 wires for connecting the switch. Pull up and down resistors can be put close to the main board.
Reasons to use a mechanical switch: Switches are the cheapest endstops in most cases, No need for opto pcb, Simple switches can be used on x and y axis, You could even make your own contact switch from a few pieces of metal, You get to solder stuff"