Main-sequence stars are fusing hydrogen into helium. These nuclear fusion take place deep in the cores of stars. Stars spend about 90% of their lives in this stage. Our Sun is about 5,000 million years into its 10,000 million-year main-sequence.
One of the fundamental forces in the Universe is gravity. It is the force that holds us on Earth. It also keeps planets in orbit around stars and stars in orbit around the centre of our galaxy.
A star's gravity pulls in on itself. This should cause a star to collapse. Unlike the Earth, stars are not solid. So what prevents them from collapsing? In main-sequence stars, it is the pressure from the nuclear fusion reactions deep in the star's core. This balance between outward pressure and inward pull is called hydrostatic equilibrium.
It may seem unlikely that the forces balance so neatly, but they actually work very well together. If something happens to reduce the amount of pressure generated by the star's core, the star begins to contract. This contraction increases the temperature and pressure which allows the core to release more energy. A new balance is found and hydrostatic equilibrium is maintained. In addition, the star now has a slightly smaller radius.
The mass of a star controls how long it stays in the main-sequence stage. More massive stars use up their fuel more rapidly than less massive ones. When a star runs out of fuel, it can no longer keep the forces in balance. At this point, a star expands and cools to become either a red giant or a red supergiant star.