The speaker injects the "antinoise" precisely at the correct moment, the anti-noise intercepts the fan noise the two pressure waves "collide" and cancel each other. Residual noise is picked up by ...