Nebula and the Protostar
The clouds of hydrogen gas and dust comprising a stellar nursery are called a nebula. It is in the nebula that a star is born. Over time, the hydrogen gas in the nebula is pulled together by gravity and it begins to spin. As the gas spins faster, it heats up and becomes a protostar, as explained on NASA's "Imagine the Universe" website. A star's mass is determined by the amount of matter available within the nebula.
Star
Eventually the protostar will reach a temperature of around 15 million degrees and nuclear fission will take place within its core. As this takes place the cloud begins to glow brightly, contracts, and becomes stable. This represents the main sequence star, as explained on NASA's "Imagine the Universe" website. This is the stage that our sun is currently at, and will remain for billions of years.
Red Giant
A star will shine constantly until all the hydrogen in its core is converted into helium by nuclear fission. This will take billions of years in a small star, but in a large star it takes only millions of years. According to NASA's "Imagine the Universe" website, when all the hydrogen runs out, the star stops generating heat by nuclear fission, becoming unstable and subsequently it contracts. Following this, the star's outer shell, composed of cooling gas, begins to expand and forms a red giant.
Supernova
Following the red giant phase, a massive star will undergo a supernova explosion. This occurs when energy is no longer radiated from the core, which is composed of very stable iron. As no energy is being emitted, gravitational collapse occurs, with the core temperature rising to over 100 billion degrees as the iron atoms are crushed together, as explained on NASA's "Imagine the Universe" website. The supernova explosion takes place when the core collapses in a shock wave, as the repulsive force between the nuclei overcomes the force of gravity.
Neutron Stars and Black Holes
According to NASA's "Imagine the Universe" website, the mass of the star following the supernova explosion determines what will happen next. If the remnant of the explosion is 1.4 to about 3 times as massive as our Sun, it will form a neutron star. Neutron stars are composed of mainly neutrons but are formed when the exploding supernova forces protons and electrons to combine, as explained by University of Bradford Robotic Telescope website. Alternatively, if the remnant from the supernova explosion is more than three times the mass of our sun, the force of gravity will overcome the nuclear forces that prevent neutrons and protons combining. Consequently, the core is swallowed by its own gravity, forming a black hole.