We can understand the working of bot with a simple analogy.
Consider a human body. Whenever someone pushes us, we tend to move our legs in the direction of push so as to balance our body. Or when we get off a bus we start running in the forward direction so that we do not fall. Similarly the robot tends to balance itself by adjusting the direction and speed of the motor.