What causes a star to eventually die or explode?
A star lives by fusing hydrogen into helium in its core, with the outward pressure from this nuclear fusion balancing the inward pull of gravity. When the hydrogen fuel runs out, the core contracts and heats up, causing the outer layers to expand into a red giant. What happens next depends on mass. Smaller stars like our Sun shed their outer layers and leave behind a white dwarf. Massive stars continue fusing heavier elements up through iron, but iron fusion absorbs energy rather than releasing it. The core suddenly collapses under gravity, and the resulting shockwave blasts the outer layers apart in a supernova explosion, leaving behind a neutron star or black hole.