It has one wheel. It has an electric motor. It has built-in sensors that determine whether it is leaning backward or forward along the disk-plane of the wheel. If the sensors determine that the centre-of-gravity is forward of the axle of the wheel, it speeds up the motor to try to keep the device balanced. That makes you speed up. If the sensors determine that the centre-of-gravity is behind the axle of the wheel, it slows down the motor to try to maintain balance. That makes you slow down. Lean forward to accelerate and lean back to brake. Simple.
This doesn’t do a thing for falling over to the side, but in cycling, motorcycling and the world of electric, self-balancing unicycles, we refer to falling over to the side as controlled carving of turns, and consider it an exhilarating and delightful part of getting around.