Except for very cheap toys, all vacuum robots, including affordable ones, include several cliff sensors. Thanks to these sensors, a vacuum robot detects when it reaches a stair edge. It then changes direction, to avoid falling down.
Cliff sensors are are located underneath the robot. They rely on infra-red light to detect gaps, and safely navigate cleaning your home. The video below shows an affordable Roomba 650 cleaning a staircase and edge of floor, without falling down.