Elevators are amazing machines, but sometimes they break and get stuck.
When the elevator stops by crashing to a stop or unexpectedly stops, one thing to remember is to remain calm, you will be safe, the elevator will NOT fall because it has ropes that are attached to the counterweight which won't move. (That's for traction) The hydraulic elevator won't fall because the hydraulic ram isn't going to go down unless the oil from the elevator is drained. (For both hydraulic and traction elevators most likely won't fall.
What to do if you're stuck: 1st: Try pressing door close or door open. If it doesn't work try pressing the floor number. 2nd: If you know the elevator doors are not opening and the car is not moving, press the alarm button. (Don't attempt to escape the elevator, the car may not be leveled with a floor and you may fall down the shaft which may lead to serious injury or even death!) 3rd: If anyone talks to you through the doors tell them you're stuck so they can get help. 4th: If nobody is available, use the emergency phone. (If there is no phone, use a cell phone or keep yelling that you're stuck in the elevator.) 5th: The Elevator could move at any time that it is stuck, if it moves to a floor and the doors open, exit with caution because it could start moving if there's a malfunction. Alert staff members of the building that the elevator had stalled and should be turned off. If you've used the emergency phone in the elevator and you notice the elevator is moving, remain calm since the elevator mechanic or the fire department is moving the elevator to get you out.
Remember: Never try to escape a stuck elevator, if you do, you could get injured or die. If it starts moving you could get crushed. Wait until the fire department/elevator mechanic arrives to help you get out safely.