3 wire PWM fan tach signal
The tach wire emits some integer number of pulses per rotation, measure the pulse frequency to determine fan speed.

The tach pin is connected to the sensor that detects the rotor magnets as part of the driver circuit for the stator. it's just a tap into the internal working of the motor.

grounding the the tach pin will prevent the motor from running. and driving it with a particular frequency can control the speed of the rotor, and sending PWM in there could modulate the stength of the motor drive and also control the speed.