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 of a star's lifetime, the interior heat and radiation is provided by nuclear reactions in the star's core. This phase of the star's life is called the main sequence.
Before a star reaches the main sequence, the star is contracting and its core is not yet hot or dense enough to begin nuclear reactions. So, until it reaches the main sequence, hydrostatic support is provided by the heat generated from the contraction.
At some point, the star will run out of material in its core for those nuclear reactions. When the star runs out of nuclear fuel, it comes to the end of its time on the main sequence. If the star is large enough, it can go through a series of less-efficient nuclear reactions to produce internal heat. However, eventually these reactions will no longer generate sufficient heat to support the star against its own gravity and the star will collapse.