Lithium-ion battery, How does it work