Being a fighter jet pilot is not nearly the safest profession, but if your passion brings you to it, you will learn all the ways of surviving. When a fighter jet finds itself on the verge of failure, the pilot will need to get out of the plane, in a condition good enough to be able to live, even if he or she can not fly again.
Now the question is, what would happen if the pilot pushed eject, the seat fires but the canopy refuses to open as it does in movies like TopGun? Imagine the pilot shooting their seat, hitting the glass, and bouncing back? Well, such a thing has never happened and never will.
In some fighters like the F-16, the seat does not fire until the jet gets rid of the canopy. In most other aircraft, canopy breakers are built into the seats that break the glass on the way out saving at least a second. Other jets have explosives embedded into the plexiglass, that tear it down to shreds milliseconds before the seat moves.
Here is a video of the AV-8B Harrier II taking off from the pilot’s perspective. The curvy lines in the cockpit glass are the explosives that blow off the canopy in the event of failure.
Watch this video of an AV-8 Harrier pilot eject right on a beach:
Here is another one showing the ejection sequence of the Russian MiG 29 where the pilot ejects just two seconds prior to the crash: