An uses light (optics) to identify unique positions for the encoder. A magnetic encoder uses the same principle to determine a position as an optical encoder, but it does it using magnetic fields rather than light.
With a magnetic encoder, a large magnetized wheel spins over a plate of magneto-resistive sensors. Just as the disk spins over the mask to let light through in predictable patterns, the wheel causes predictable responses in the sensor, based on the strength of the magnetic field. The magnetic response is fed through a signal conditioning electrical circuit.
The number of magnetized pole pairs on the wheel pole, the number of sensors, and the type of electrical circuit all work together to determine the resolution of the magnetic encoder.
The key to using magnetism as the element to produce a signal is that it is unaffected by very demanding environments – including dust, moisture, and extreme temperatures, and shock.