Stars such as the sun are large balls of plasma that inevitably fill the space around them with light and heat. Stars come in a variety of masses, and mass determines how hot the star will burn and how it will die. Heavy stars turn into supernovae, neutron stars and black holes whereas average stars like the sun end life as a white dwarf surrounded by a disappearing planetary nebula. All stars, however, follow roughly the same basic seven-stage life cycle, starting as a gas cloud and ending as a star remnant.
TL;DR (Too Long; Didn't Read)
Gravity turns clouds of gas and dust into protostars. A protostar turns into a main sequence star which eventually runs out of fuel and collapses more or less violently, depending on its mass.
A Giant Gas Cloud
A star begins life as a large cloud of gas. The temperature inside the cloud is low enough for molecules to form. Some of the molecules, such as hydrogen, light up and allow astronomers to see them in space. The Orion Cloud Complex in the Orion system serves as a nearby example of a star in this stage of life.
A Protostar Is a Baby Star
As the gas particles in the molecular cloud run into each other, heat energy is created, which allows a warm clump of molecules to form in the gas cloud. This clump is referred to as a Protostar. Since Protostars are warmer than other material in the molecule cloud, these formations can be seen with infrared vision. Depending on the size of the molecule cloud, several Protostars can form into one cloud.
The T-Tauri Phase
In the T-Tauri stage, a young star begins to produce strong winds, which push away the surrounding gas and molecules. This allows the forming star to become visible for the first time. Scientists can spot a star in the T-Tauri stage without the help infrared or radio waves.
Main Sequence Stars
Eventually, the young star reaches hydrostatic equilibrium, in which its gravity compression is balanced by its outward pressure, giving it a solid shape. The star then becomes a main sequence star. It will spend 90 percent of its life in this stage, fusing hydrogen molecules and forming helium in its core. The sun of our solar system is currently in its main sequence phase.
Expansion into Red Giant
Once all of the hydrogen in the star's core is converted to helium, the core collapses on itself, causing the star to expand. As it expands, it first becomes a sub-giant star, then a red giant. Red giants have cooler surfaces than main sequence stars; and because of this, they will appear red rather than yellow. If the star is massive enough, it can become large enough to be classified as a supergiant.
Fusion of Heavier Elements
As it expands, the star begins fusing helium molecules in its core, and the energy of this reaction prevents the core from collapsing. Once helium fusion ends, the core shrinks, and the star begins fusing carbon. This process repeats until iron begins appearing in the core. Iron fusion absorbs energy, so the presence of iron causes the core to collapse. If the star is massive enough, the implosion creates a supernova. Smaller stars like the sun contract peacefully into white dwarfs while their outer shells radiate away as planetary nebulae.
Supernovae and Planetary Nebulae
A supernova explosion is one of the brightest events in the universe. Most of the star's material is blown into the space, but the core implodes rapidly into a neutron star or a singularity known a s a black hole. Less massive stars don't explode like this. Their cores contract into tiny, hot stars called white dwarfs while the outer material drifts away. Stars smaller than the sun don't have enough mass to burn with anything but a red glow during their main sequence. These red dwarves, which are difficult to spot but which may be the most common stars out there, can burn for trillions of years. Astronomers suspect that some red dwarves have been in their main sequence since shortly after the Big Bang.