Both the weight and the elevator car are held in place by guide rails at the sides of the elevator shaft (the tunnel the elevator is in). A motor can turn the wheel in either direction so that the elevator either goes up or down (with the weight doing the opposite). When you push the button inside the elevator, you activate the motor. When the motor stops, the grooves in the pulley wheel keep the rope in place so the elevator stops moving.