Let’s start the discussion with something that we know and see daily. We have studied from childhood that stars are the massive bodies in the universe that shine by themselves. We also know the closest star to us, The Sun. But, what is it that makes The Sun and other stars like it shine so brightly for almost forever?
Firstly, let’s address the fact that there are many types of stars. The Sun, is a Main sequence Star. Some stars are bigger than sun viz, Giants and Super Giants. Some stars are smaller than The Sun viz, White dwarfs. Basically, at the time of birth stars are a huge mass of gas. In general, all the stars are made up of two thirds of Hydrogen and one thirds of Helium. These gases form a cloud which collapses when the pressure and temperature are high enough to start a Nuclear Fusion reaction. Thus a Star is born.
The Nuclear Fusion fuses two Hydrogen atoms to a Helium atom generating a massive amount of energy at very high temperatures almost to millions of degrees. This process is continued for the most of the lifespan of the star and these stars are called the Main sequence stars. You might be thinking that fusing two Hydrogen to helium is the cause of the light and the heat of The Sun but, the Hydrogen deposits will be extinct some time or later. Yes. You are right. The Fusion reactions on The sun Gallop Hydrogen at the rate of almost 4 Million Kg per second. But, the mass of The Sun is so huge that even at this rate it will still take Billions of years for the Hydrogen deposits to become extinct.
What after the deposits in the center are spent? For the small stars like The Sun and stars smaller than it, they cannot continue the Fusion and therefore eventually become dimmer and cooler and turn into White Dwarfs. But, for the bigger stars, the process doesn’t stop there. Bigger stars continue to fuse the Hydrogen atoms in their outer layers thereby expanding there radii even more and growing even bigger and brighter. The star thereby leaves the Main sequence. This gives rise to the Red Giant. But, this can only happen to the stars having mass up to three to eight times that of The Sun. The process continues and the hull or the outer layer further expands as the fuel in the outer layers starts depleting. This gives rise to Planetary Nebula. The core is left behind as an inactive white dwarf which continues to get dimmer and fades away slowly. This last phase is relatively short as compared to the Main sequence event.
Now, what about the stars that are way bigger than The Sun? For these kinds of stars, the Nuclear fusion happens very rapidly and results into heavier metals like iron or copper. After the Main sequence of the star, it becomes bigger and bigger and becomes unstable. Once the center of the star has become full of heavy Iron core, it cannot continue with the Fusion. It has reached the dead end. As the Iron core becomes heavier and heavier, it cannot handle its own mass and Gravitation and it eventually collapses to form a Neutron Star or in some cases a Black Hole.Very few stars have this kind of huge mass.
So basically, all depends on how big the Star is and how much mass it has. Bigger the star, faster are its Fusion reactions thereby brighter it is. Bigger stars also have a greater lifespan. The Stars with small masses will cool off just after the main sequence but, the bigger stars will go through some more phases and the Biggest of them might give rise to a neutron star as they become extinct.