How does a magnetic sensor measure the angular speed of a crankshaft? How does its spinning affect the magnetic flux?
Either the teeth are magnetic or there are strong magnets fitted into the flywheel usually at TDC (Top Dead Centre) and some amount of degrees before (or after) 10, 20 or 30 maybe.
The ecu can then use the duration between the two pulses to calculate the speed of the engine (rev/min) and the rate of change which is used to predict fuel delivery.