Nine out of ten stars that you see in the sky are main-sequence stars, and our sun is one of them. Most main-sequence stars probably started out as brown dwarfs, and then succeeded in getting enough mass together to begin a nuclear fusion reaction inside them. It’s the energy from this nuclear fusion reaction, changing hydrogen atoms into helium atoms and releasing the extra energy, that makes the stars shine.
What holds a star together is a balance of two forces pushing against each other. Gravity pulls the star’s atoms in towards the center, just as gravity pulls you toward the Earth. The fusion reaction going on inside the star pushes the atoms away from the center, towards space. When these two forces are equal, the star can continue existing. Generally the two forces do stay in balance. That’s because whenever the fusion reaction begins to slow down, it doesn’t push out as much. Then the gravity can push in more, and that forces the hydrogen atoms closer together, which starts up the fusion process again and restores the balance.
Because the forces pushing in and out are the same in all directions, stars are basically shaped like balls. But because stars also spin around, centrifugal force tends to flatten out the ball a little, so most stars are a little thicker around the middle than they are at the top or bottom.
Main-sequence stars fall out of balance when they have used up all of their hydrogen fuel. Bigger stars, which burn hotter, use up their fuel faster, and smaller, cooler stars last longer. The biggest main-sequence stars last only a few million years, while the smallest main-sequence stars last over a trillion years. Once the star has used up all its fuel, it expands into a supergiant star.