This must be known to us that, all of the commercial aeroplanes have a backup for everything. It includes backup engine, auxiliary fuel pumps, dual spark plugs, dual electrical displays, and circuitry. Therefore the chances of aircraft accident are very rare.
But, even if all the backups fail? What will happen when an airplane loses all sort of power (including power to engine), particularly electrical power.
The biggest factor is to consider that how much altitude the pilot have to work with, and how close they are to the nearest airfield that is capable of handling the specific aircraft type under the specific conditions. As a fundamental rule, “Altitude is your closest friend” when it comes to such situations.
When all the batteries and auxiliary power unit (APU) fails of an aircraft, it would lose all its electrical power. For this particular situation, all commercial airplanes are equipped with an emergency backup device known are Ram Air Turbine (RAT).
The Ram air turbine i.e. basically a mini wind turbine, pops out of the bottom of an aircraft and generates electricity from the air stream by ram pressure due to the speed of the plane.
Here in this video showing how RAT looks like:
The best part of using a RAT instead of a backup APU is that it will never run out of power as long as the plane is flying requiring no fuel at all. It provides a reliable operation on demand without affecting flight performance. The Ram air turbine activates automatically when power on board is insufficient. It drops by a spring load mechanism and gravity.
For safety purpose, the plane runs in an extreme low-power model, when RAT is in use as the power supply. There is no in-flight entertainment and no lighting. The power produced by the ram air turbine is enough to run basic navigation, basic fly by wire, and limited control of flight surfaces. The power, however, is sufficient for an emergency landing.
In this way, pilot saves the lives of all passengers.