Lithium-ion
batteries in EVs can
fail due to:

Manufacturing defects, stress from vibrations, electrical short, etc.

Batteries then
undergo thermal runway, increasing temperature and pressure

and also releasing flammable gases.

Although rare,
EV fires can be quite dangerous.

But you can prevent them.

Don’t charge EV batteries immediately after use.

Let the battery cool first.

Charge detachable batteries only after removing them.

And keep them in cool and dry areas.

Finally, only use authentic batteries for your vehicle.