What happens inside a star during its entire lifetime?
A star begins its life when a cloud of gas and dust collapses under gravity, heating until hydrogen fusion ignites in the core, producing the outward pressure that balances gravity. For most of its life, the star fuses hydrogen into helium in this stable main sequence phase. When hydrogen runs out, the core contracts and heats further, causing the outer layers to expand into a red giant while helium fusion begins. Successive fusion stages create heavier elements up to iron, which cannot release energy through fusion. Once an iron core forms, gravity wins and the star either collapses into a white dwarf, neutron star, or black hole depending on its mass, sometimes triggering a supernova explosion that scatters heavy elements into space.