How do you prepare for the unexpected? It is, by definition, something you did not predict ahead of time.

In dealing with the unexpected, the important thing is what tools you have at hand to deal with the various facets that present themselves, and to recognize, isolate, and work the problem. Put another way, work through all the failure modes you can. Have a plan, or set of them. Sure, there may not be one that is a "perfect fit," but simply having the plans, and practicing them, gives you a structure to work with when you need to improvise. It also gives you an idea of what various choices may be available, and the consequences of the actions you take based on those. In part this also goes hand in hand with developing a deep knowledge of the systems involved, where possible.

But a so-so plan that you've already considered and are ready to execute is better than waiting to come up with a plan, and may give you the breathing room, and thus the option, to come up with a better one.

The standard in casualty training for the Navy, on subs, wasn't to just get the whole department together and lecture at them on the procedures. We did several things.

First was, for all intents, a role-playing session. The relevant watch team/shift that had to work together would meet. A scenario and symptoms would be presented. This could be anything as simple as upshifting the engineroom from ahead 1/3 to ahead flank, to loss of one side due to steam leak, or coolant leak, or worse. Each person would step through their role, what actions they would have to take down to valves turned, what air manifolds they would plug into, etc., and work out the needed coordination, reports, and so forth. "OK, while upper level does  that, I go and cut off this..."

Often the office or chief acting as facilitator would start throwing in additional wrinkles. Air masks not working, electrical shorts and grounds complicating a casualty that took out half the engineroom, and other twists.

Kindof like a real game of D&D, where the GM tells the players what the world does, and the players tell the GM how they respond.

Is this complete? No - see "can't predict every possibility". But it gets you in the mindset of working the problems and what the possibilities are. Who you need to talk to, and so on. If someone is injured, the rest of the the team has a refresher on what needs to be done as someone takes on multiple roles.

But then we also run drills. Get into fire suits, haul hoses, haul flooding pumps and patches, shut down and start up equipment, figure out that certain water connections are just not close enough to deal with certain fires, or it gets too crowded if several groups come through the same passage, or that someone needs to go up a level to help prevent spread.

Or kidnap the XO and ziptie him to the treadmill as a meatshield for a security drill... there's a reason they rarely let nukes be the antagonists for those...

The point is that working out the known possibilities, looking at the practical limits for certain solutions, and having a group of people each look at the problem, and then try it in real life, and iterate to deal with the issues, and try again, gave us the widest range of tools to deal with the truly unexpected, or when more than one thing broke.