As the fan blades spin they disrupt the beam of infrared light between the emitter and the receiver ... You won’t be limited to an IR sensor, but can use a hall effect sensor in the same ...
The receiver also has sockets for several IR emitters (IR flashers) that are wired to, and pasted directly over, the IR sensors for precise aiming. High-end, third-party remote controls use radio ...