Detent. A detent is a mechanical or magnetic means to resist or arrest the movement of a mechanical device. Such a device can be anything ranging from a simple metal pin to a machine. The term is also used for the method involved.

Magnetic detents are most often used to divide a shaft rotation into discrete increments. Magnetic detents are inherent in some types of electric motors, most often stepper motors.

Mechanics

Arresting movement

Ratchet and pawl
The ratchet-and-pawl design arrests movements by employing a small gravity- or spring-actuated lever paired with a notched wheel. The lever is mounted on a pivot point in proximity to the wheel.

The vertical angle of the sides of the notches that face the direction of rotation
desired is generally very acute (45 degrees or less), so that as the wheel rotates in that direction, the end of the lever is easily lifted or pushed out and over the top of a notch.  Following this, the lever drops into the next notch and the next et cetera as the wheel or shaft continues to spin.

The angle of the backside of the notch is severe (usually 90 degrees or greater to the end of the lever) so that the lever cannot be pushed up or out of the notch if wheel attempts to turn in the opposite direction. The lever is jammed between the back of the notch and its pivot point, stopping movement in that direction against any force that the materials used can withstand. The wheel has little resistance moving in the direction desired, other than that required to lift or push the lever over the next notch.

Resisting movement
To resist movement (or when creating incremental steps), methods are employed which include a spring-loaded ball detent that locates in small incremental depressions, or a piece of spring steel that snaps into position on flat surfaces or shallow notches milled into the shaft or wheel.

Motor detents 
Stepper motors rely on magnetic detents to retain step location when winding power is removed. They are well suited to be used in printers and numerical control (CNC) devices.

Examples
A well-known example of a detent can be seen on the popular game show Wheel of Fortune, which employs rubber flippers to help disambiguate on which wedge the wheel has stopped after being spun by a contestant.  Other common examples include:

 A balance control on a piece of stereo equipment which seems to "click" or "snap" into the center position of its rotation, indicating the point where the volumes of the left and right channels are equal or "balanced", or volume controls with a separate detent to match each of the digits on the control knob (typically 10).
 Rotary switches typically employ detents to keep the control shaft properly aligned with the appropriate contact. 
 Any spring-powered wind-up toy employs one, in order to disallow unwinding of the spring.
 The ratchet wrench, which is employed to intentionally use force against the detent and comes in an increasing variety of types. It was designed to allow one to keep the wrench engaged with the bolt or nut which it is turning, in an area where the swing arc of the wrench is limited, while being able to continue to turn it in one direction by simply pulling the handle back and letting the detent reposition itself.  The repositioning allows the wrench to be forcibly turned again.
 The scroll wheels on many computer mice employ detents to divide scrolling into discrete steps.
 The shutter button on many cameras has a detent to selectively activate autofocusing and exposure calculation. Further pressure on the button then passes the detent and activates the shutter.
 Many aircraft have detents on the thrust lever for pre-set thrust values e.g. climb or reverse thrust.

See also

Ball detent
Spring plunger
Ratchet (device)

References

Mechanisms (engineering)