We have two options available for end stops: optical and mechanical.
Mechanical uses a switch, which triggers when hit. The optical uses
infrared and detects a blockage of the light with a sensor. The
advantage of a mechanical end stop is the easy implementation, the
optical end stop can be a bit fiddly. But the mechanical end stop has a
much shorter lifespan, as it wears out sooner. Another advantage of the
optical end stops is precision, especially for the Z-axis a high
precision is recommended.