They send you up in a small airplane and turn off the engine. Just kidding.
There is no formal training, except in the use of standard emergency equipment such as evacuation slides and the emergency oxygen system.
Every aircraft has an elaborately detailed set of emergency procedures which are kept in binders (although this is shifting to iPads). When something bad happens, you are supposed to turn to the relevant section of the binder (there are quick reference tabs) and follow the instructions. In theory, you are supposed to memorize all the procedures, but in practice most pilots just know the critical ones, like fires and engine failures. Even if you think you have the procedure memorized, you are still supposed to use the checklist.
One problem with simulating emergencies is that it is dangerous. For example, the FAA used to mandate spin training for all pilots. Then, years later, they found out more people were getting killed in the spin training, than were getting killed in real, actual spins. That put an end to the spin training.