The sun started as a large ball of hydrogen gas -that contracted under its own gravity. As it collapsed, it began to spin rapidly (this process sometime leads to the formation of a double star system, or to the formation of planets). This increased the sun core temperature to, at least, 10 million degrees when the fission of hydrogen to helium started. The sun should go on burning this way for at least 10 billions of years. It is now in the middle of the cycle.
Stars similar to the sun
They follow the same process as described above for the sun. When all the
hydrogen is burned, the stars begin to burn helium making them to expand.
They are now known as red giants. After the helium is exhausted, the outer
layers of the stars dissipate in space and their cores become "White
Dwarfs".
Stars 10 to 40 times the mass of the sun
The fusion of hydrogen proceeds more rapidly. When they become Red Super
Giants. Light elements up to iron are used in their core. They are now hybrid
stars, red giants with white dwarfs inside. When the element iron is formed
the fusion stops. The stars collapse on themselves creating high pressure
and temperature up to 3 trillion degrees. They then explode in supernova
increasing again the temperature allowing the fusion process to restart
to produce the elements of the periodic table after iron.
After the explosion of the supernova, neutron stars made of solid matter are created. Neutron stars emit radiation irregularly. They spin rapidly and behave like rotating light houses emitting radiation instead of light. They appear to pulsate and this gives them their names: Pulsars.
In the case of one original star with a mass more than 40 times the mass
of the sun, the explosion of the resulting supernova may leave behind a
neutron star larger than 3 solar masses. The gravity of this neutron star
is so big that it can counteract the repulsive force between neutrons, and
the star may collapse again, this time in a black hole.