If this large cloud of gas and dust is cool enough, it will contract due to the gravitational attraction between the particles that make up the cloud. Eventually, the continuous contraction will put a lot of pressure on the innermost region – the core. First, the electrons that were attached to the initially neutral gases would be stripped off, forcing the gas to become charged. A charged gas is called a plasma.
The positively charged hydrogen nuclei in the core would then collide with one another with such tremendous forces that would allow them to fuse. This process, called nuclear fusion, results into the formation of helium. The energy released by nuclear fusion prevents the star from collapsing further. At this point, when nuclear fusion occurs, what was once a cloud of gas then becomes a star. In our case, the Sun.
In the entire life cycle of the Sun, it is at this point that we now exist. The Sun keeps on burning, i.e., through nuclear fusion. These nuclear reactions produce high-energy electromagnetic waves that travel for tens of thousands of years outward. Eventually, they reach the surface and are released to space in the form of lower-energy visible, ultraviolet, and infrared light.
This is what illuminates our planet now.
Later on, when all the hydrogen gets consumed into helium, there will be no more energy that will push outward and prevent the Sun from collapsing. As a result, it will collapse. The collapse will put tremendous pressure on the helium core and cause the helium nuclei there to fuse into heavier elements just like before.
Once again the fusion will push the outer regions outward. This time, the outward push will allow the Sun to expand much larger than it was earlier in its lifetime. At this point in the life cycle of the Sun, it will then become a Red Giant. While the outer regions continue to expand, the helium nuclei in the core will continue to fuse into carbon.
Now, carbon will no longer fuse further. As such the Sun’s core will stabilize while the rest of its outer regions will proceed with their expansion and will eventually be shed off. The core will be known as a white dwarf, while the outer regions will be known as a planetary nebula.
In the end of the life cycle of the Sun, the white dwarf will release all of its remaining heat and will evolve into a cold dark mass known as a black dwarf.
Finally, here’s a podcast from Astronomy Cast that you might want to listen to: The Life of the Sun