Running Out Of Gas
As time goes on, the amount of hydrogen in the core decreases and the rate of fusion drops; this, in turn, causes the core to contract under the pressure of the star’s outer layers, which consequently results in a temperature increase outside of the core. When the pressure rises high enough, fusion of hydrogen in a “shell” outside the core begins to occur. Since the volume of a sphere is related to the cube of the radius, this increase boosts the fusion rate significantly, causing the star to become brighter and (due to the greater outward pressure) larger.
Eventually, a star converts all of its hydrogen into helium. This spells the beginning of the end, since fusion of each element past hydrogen generates less energy than the previous step. The process continues for as long as there is sufficient stellar mass to compress the core enough to continue fusion - once a star reaches iron, it can’t go any further, since the fusion of iron requires more energy than it produces.
The specifics of what happens when a star leaves the main sequence depend on its mass. If it is less than half the mass of the sun, it just trundles along without sufficient mass to fuse helium, gradually running out of energy as it depletes its hydrogen stores; since they’re so light, their fusion rate is very low and their theoretical lifetimes can range into the hundreds of billions of years. If it happens to be greater than half but less than three times the mass of the Sun, the helium-burning phase causes it to leave the main sequence and become a red giant when hydrogen fusion shifts to a shell around a mostly helium core. Eventually, it exhausts its helium resources and, with insufficient mass/pressure to fuse elements past carbon, it throws off its outer layers as a planetary nebula and becomes a white dwarf. At this stage, the star is literally a cinder that eventually fades to a black dwarf.
Supergiants and Supernovas
If the star has greater mass, it can repeat this process, turning into a dwarf if it fails to fuse the next element; the only exception is that the internal pressure causes a more intense fusion reaction - as a result, the star becomes even larger - a supergiant, rather than just a giant. Given an initial mass 10 or more times that of the sun, their death will result in a supernova; the mass of the star is so great that it can successfully fuse elements up to iron, but at iron, exothermic fusion (fusion with a net energy surplus) ceases. The star then collapses until the pressure is high enough to fuse iron, absorbing a significant amount of energy in the process but creating a tremendous amount as well. Consider that stars spend millions or billions of years burning hydrogen and helium, while the time remaining after switching to carbon may be thousands of years and the fusion of silica into iron takes fractions of a year at most. A supernova can release on the order of 1044 joules, about 1018 times the sun’s energy output in any given second, or approximately equivalent to its energy output for eight and a quarter billion years, three billion years longer than it has been around.
At this point, the remnant of that explosion becomes a neutron star (if its initial mass was less than 20 solar masses) or a black hole, but that’s a story for another article…
If all of this inspires you to make your own star, try out this star generator!