An escalator is really just like a conveyor belt. The stairs are pulled around in a loop by a pair of chains. What’s tricky about escalators is keeping the steps level while they’re going up the slope (so you’re not tilted). The other trick is getting them to stay level at the beginning and end of the ride so people can get on and off safely.
Escalator steps have two sets of wheels. One set is at the top of each stair, and is pulled by the chains. At the bottom of the step is another set of wheels that runs along a metal pathway (like train tracks). The pathway is sloped between floors, but at the top and bottom of the rise, the track becomes flat before going around and back down, below the floor. When the steps are coming up the slope, each one is higher than the one before, like stairs, but when they reach the level part, they flatten out.