Like most controlling units it has a feedback (signal from the output to the input) in the form or a current or voltage.
This feedback is the present value of the speed, which has a proportional relation to a voltage or current. That value is compared with the set value (or set point) of the speed control unit, they are compared and the output is altered. These are analog values usually, but can also be digital - which would mean that there would be switching (ON-OFF).
In a digital feedback, if the set value is greater than the present value, the feedback and output is ON, it will continue to be ON till it reaches the set value. When it crosses the set value, the output is OFF, so the speed reduces, as it goes below the set, its again ON. So there is a switching of this sort to maintain the value.
In an analog feedback, if its greater than the set speed, the voltage or speed-controlling electrical parameter is reduced to the requirement. If the feedback value is less than the value required for the set speed, its increased accordingly. In a PID control the present value (viz. also the feedback) is an analog value. But you can have a control system (for speed or anything) with a digital (ie. full-on, full-off) feedback. But with digital feedback you get less stability and would require quicker swicthing (ie. more feedbacks and comparisions per unit time) to make it more stable.
This is the basic principle/logic in any control system or unit: The present output is compared to the value that has been set, and output is changed accordingly. That output again is fedback as a signal to the input, again compared to the set value and output changed accordingly. The process keeps repeating and the fast it takes for one cycle of feedback, compare and give output.