As stars get smaller, they live longer. Earth's sun has been around for 4.5 billion years, slowly turning hydrogen into helium at its center. It will run out of this hydrogen fuel in another five billion years or so, becoming a red giant; expanding to many times its original size; ejecting its outer layers and shrinking down to a tiny white dwarf star. So the total lifespan of a star with the sun's mass is about ten billion years.
Red dwarfs are the smallest stars are the red dwarfs, starting at 50% the mass of the sun, and they can be as small as 7.5% the sun's mass. A red dwarf with only 10% the sun's mass will emit 1/10,000th the amount of energy given off by the sun.
Also, red dwarfs lack radiative zones around their cores. So the convective zone of the star comes right down to the cure. The star's core is continuously mixed up, and the helium ash is carried away to prevent it from building up. Red dwarf stars use up all their hydrogen, not just the stuff in the core. It’s believed that the smaller red dwarf stars will live for ten trillion years or more.
The size of the star will always play a huge role in the amount of time it will take before the star runs out of energy. An average star can still last for millions of years. It has that much amount of energy that can be stored inside.
This means that the stars that we see in the sky have been there for millions of years and would still continue to be seen by other people in the years to come.
For massive stars, it would take billions of years before they die out. When a star dies out, it will form a planetary nebula. The core of the star will start to become cool. It will become a white dwarf and then a black dwarf.