The fan module is controlled by the engine computer. With the temperature sensor unplugged, the ECU runs a default mode because it can't know what the engine temperature is... and turns the fan on to make sure the engine "won't" overheat.
What you now know is that the fan works and the computer is capable of turning on the fan. (It's possible that the fan has still failed and was "fixed" by jiggling with it when you did the testing...but that's unlikely if the fan isn't turning on by the ECU when it should be...)
The next question is why the ECU isn't commanding the fan on. The temperature sensor wires go straight to the ECU, so it's a likely candidate...but there are other possibilities (reliable voltage supply to the sensor for example).