Diagnosis
The triac or the speed control circuit on the main board is malfunctioning. This component regulates the power to the motor to create different speeds. When it starts to fail, you lose the intermediate speed settings.
How to Fix It
Unplug the fan for at least 30 minutes to let all capacitors discharge and the board do a full cold reset. Sometimes, a power glitch can cause the control chip to get stuck in a weird state. Plug it back in and test. If the problem persists, it's a hardware fault.
If That Didn't Work
The physical speed control button on the panel could also be faulty, sending erratic signals. You can try carefully cleaning around the button with contact cleaner, but the buttons are usually sealed membrane types, making this difficult. The root cause is still likely on the board receiving those signals.
Heads Up
Running the fan only on the highest setting for prolonged periods because the others don't work can put extra stress on the motor and might lead to overheating or premature failure of the motor itself.