Here's how it works:
* Gravity: The immense mass of a star creates a powerful gravitational pull inwards, trying to crush the star under its own weight.
* Nuclear Fusion: At the core of a star, the intense heat and pressure cause hydrogen atoms to fuse together, forming helium and releasing enormous amounts of energy. This energy creates outward pressure that counteracts gravity.
This balance is crucial for a star's stability. If gravity were stronger, the star would collapse. If the outward pressure were stronger, the star would expand.
This equilibrium is a delicate one, and stars evolve over time as their fuel supply changes and the balance shifts. Eventually, stars run out of hydrogen fuel, leading to their eventual demise.