Why does a speed-controlled computer fan require 4 pins?
While the statement that "any DC motor can be driven with PWM" is broadly correct* if the actual motor is PWM controlled, in a given implementation the motor proper may be hidden behind an internal controller, and this the case for the very large majority of devices that use small BLDCMs (Brushless DC motors).
Most small modern fans use BLDCM's.
In a BLDCM the motor speed is notionally independant of applied voltage. A range of voltages will be requied to operate correctly but within that range the voltage will have either essentially no effect on motor speed or a second order one.
If a system uses PWM to control an external motor's speed, special attention will be required to translate the speed control signal into actual control of speed. A BLDCM usually uses magnetic sensors ** (usually Hall sensors) to determine rotor position and to switch voltages appropriately. The electronics may be as simple as the sensors but more usually there is a control IC. If voltage is changed the controller will usually attempt to oppose any change and maintain constant speed. A PWM signal or a DC level could be used as a signal to a controller re appropriate speed.
Some DC motors are not overly keen on being PWM'd due to interesting arrangements of field coils. While small brushed DC motors in consumer equipment may use permanent magnets, larger motors tend to have wound rotors and may have fields in series ("Universal motor" as in vacuum cleaners - revs unto death if unloaded), parallel or some compound arrangement. Consultation of dry and dusty tomes and manufacturers' spec sheets recommended if ever considering PWMing "real" motors.
** Some controllers determine rotor position from back-emf on windings and other esoteric schemes may exist. Hall sensors seem to be a common solution.
The PWM input on a typical speed-controlled computer fan expects a logic-level PWM signal, usually around 20 kHz. These sorts of fans have an on-board embedded microcontroller (or similar hardware) which controls the speed by controlling the motor sequence timing (most PC fans are brushless DC motor driven).
In my experience, a BLDC motor won't regulate its speed smoothly if the input DC is chopped. If the average DC voltage is too low, they may not even start up at all, or the speed becomes erratic. Sometimes the fan will abruptly change speed, other times it will smoothly ramp up and down (it depends on the fan manufacturer and their fan control logic).
(Some Delta fans also don't like excessive jitter on the PWM signal, by refusing to change speed or taking a long time to transition.)