Chemist here, not much of an aviation expert.
Batteries are energy sources and as such, all types of them do have unpleasant failure modes related to uncontrolled release of the stored energy.
What makes Li-Ion batteries different?
- They have very high energy density, making them useful in many use cases where e.g. NiMH or lead-acid cells will not do. This leads us to:
- They are everywhere. Before the dawn of the Lithium era, few people carried battery-powered devices. The devices were expensive, bulky, had limited battery run and whoever carried them had a very good reason for this.
- They require precise electronics to keep them safe. The battery management electronic circuits embedded in every battery have their own failure modes.
- Their electrolyte is not water-based. In earlier battery technologies, the battery water content was significant and this, together with their lower energy density, limited the battery ability to produce high temperatures, capable of igniting nearby objects. In the general case, the Li cell electrolyte is somewhat flammable itself.
In short, Li batteries can sometimes self-ignite and in very rare cases, explode. When they self-ignite, they usually burn like a firework, throwing flames and seeding sparks around. The whole show spans over 1-10 seconds.
The firework-like burning is not controllable with the usual firefighting methods (e.g. powder or foam) because the process does not use air in the first place. Water is the right thing to use.
On the other hand, the damage is limited by the battery size. A phone battery can cause very bad skin burns, but is hardly capable of starting a fire, even if one really needs to.
What is done in airplanes, to mitigate these risks?
The most important: Airlines limit the size of the batteries. One is not allowed to bring a battery of more than 100 watt-hours on an airplane. This amounts to a very large laptop battery or a very large USB battery bank.
A 100 watt-hour Li battery is not capable of explosion strong enough to destroy a vital plane structural element or system.
The worst it can do is to ignite some combustible material nearby.
If uncontrolled, an airplane fire is a recipe for a problem, but this is what the fire supression systems in the cargo rooms are for.
The limited size of the batteries and the halon system together really do solve the problem.
The fire gets completely extinguished instead of just contained.
If the bad thing happens in the passenger cabin, the cabin crew is trained to deal with the problem as well.
In order to bring an airplane down by a Li battery, one needs at least 30kg battery of fairly low quality.
This is really hard to check in unnoticed and even harder to carry by hand.
Even then, a big Li batteries are usually made of small cells and it requires as much as a car crash to make many of them go off at once.
In regard to landing a plane from 40000ft:
Ever tried to stop a car running at a highway speed in emergency? If you are a very good driver and the car is in top condition, you need something like 10 seconds. If the car catches fire for some reason, by the time it stops it usually burns hard and the only viable strategy is to get out as quickly as possible.
In an airplane cruising at 40000ft, an emergency landing can take as little as 20 minutes if a clear runway is available just at the right distance ahead or e.g. 2 or 3 hours if you are crossing the ocean.
This is why airplanes are made (and organized!) to limit the emergencies possible and to deal with them onboard.