01Identify the axis and direction, and move back the safe way
The alarm tells you the axis and whether it was positive or negative. Jog slowly, only in the opposite direction to the limit. If you try to move in the blocked direction it will not let you, and that is exactly right. Getting the axis out does not fix the cause, it only frees the machine.
02Check that the machine has been referenced
If it has just been switched on and no reference return was done, the software limits do not apply and the axis will run into the physical stop. Confirm it by looking for the reference marks on the position display. If they are missing, do the reference return using the normal procedure before anything else.
03Check the active work coordinate system and its value
Look at which G54, G55 or whichever is active right then and what values it holds. A work offset with an extra digit in Z or with the sign flipped sends the tool straight into the limit switch. Compare against the value it had the last time the job ran correctly; if it is written on the setup sheet, it takes a minute.
04Check the length offset of the tool that is loaded
An offset measured too long, an H called that does not match the T in the spindle, or wear entered with the wrong sign will all make Z demand travel the machine does not have. Verify that the offset number matches the actual tool and that the length makes sense compared with the physical tool.
05Find the block that commanded the move
See which line the program stopped on and what coordinate it was asking for. If it is a retract to a tool change or a safety positioning move, it is usually the work offset or a tool offset. If it is a coordinate from the part geometry itself, check that the workholding and the part position are what was assumed when it was programmed. If the program was started from the middle, start again from the top.
06If the axis will not release or a hard limit switch is tripped
That is no longer an operator task. Every builder has its own procedure for backing an axis off a hard limit and it varies a great deal from machine to machine. Call maintenance with the machine manual in hand. A limit switch is never defeated or bypassed just to be able to move.