RepRap's Cartesian axes all need a datum (also known as home position or end-stop) to reference their movements. At the start of each build each axis needs to back up until the datum point is reached. The switches also help protect the machine from moving past its intended range and damaging itself.
These Mechanical Enstops are the most basic form of Endstops, think of it as a ordinary switch, two wires; when connected sends an signal to the electronics.
These endstops; Hall effect sensors is a transducer that varies its output voltage in response to a magnetic field. Hall effect sensors are used for proximity switching, positioning, speed detection, and current sensing applications.(--Wikipedia)
E. g: Hall-Θ.