In principle it's all simple, but what exactly happens inside is not as well studied as combustion engines.
Case in point: this year researchers found out that a type of tape used in li-ion batteries is actually not chemically stable in this environment and replacing it with a different material increased lifespan by 10% and decreased self-discharge by 70%:
https://techxplore.com/news/2023-09-tape-lithium-ion-batteri...
Plenty of other stories of this type - one of them brought LFP batteries into the limelight, because researchers figured out how to close to double their capacity.