Before it was a star
A star is a sphere of gas held together by its own gravity. A star’s life is a constant struggle against the force of gravity. Gravity constantly works to try and cause the star to collapse. The star’s core, however is very hot which creates pressure within the gas. This pressure counteracts the force of gravity, putting the star into what is called hydrostatic equilibrium.
A star is okay as long as the star has this equilibrium between gravity pulling the star inwards and pressure pushing the star outwards.
During most a star’s lifetime, the interior heat and radiation is provided by nuclear reactions in the star’s core.

Image: Sun Emits a Solstice CME | Credit: NASA Goddard

Image: Sun Emits a Solstice CME | Credit: NASA Goddard
Before it was a star
A star is a sphere of gas held together by its own gravity. A star’s life is a constant struggle against the force of gravity. Gravity constantly works to try and cause the star to collapse. The star’s core, however is very hot which creates pressure within the gas. This pressure counteracts the force of gravity, putting the star into what is called hydrostatic equilibrium.
A star is okay as long as the star has this equilibrium between gravity pulling the star inwards and pressure pushing the star outwards.
During most a star’s lifetime, the interior heat and radiation is provided by nuclear reactions in the star’s core.
Video: Sun Emits 3 X-class Flares in 2 Days | Credit: Genna Duberstein, Scott Wiessinger, Karen Fox
Energy
The total amount of energy that a star can generate through nuclear fusion of hydrogen is limited by the amount of hydrogen fuel that can be consumed at the core. For a star in equilibrium, the thermal energy generated at the core must be at least equal to the energy radiated at the surface.
Video: Sun Emits 3 X-class Flares in 2 Days | Credit: Genna Duberstein, Scott Wiessinger, Karen Fox
Death of Star
Sooner or later, though, all stars begin to run out of hydrogen in their cores, and stellar death gets underway. Once a star has exhausted its supply of hydrogen in its core, leaving nothing but helium, the outward force created by fusion starts to decrease and the star can no longer maintain equilibrium. The force of gravity becomes greater than the force from internal pressure and the star begins to collapse.
The results of this collapse depend on the mass of the star.