The mass of a star determines its life cycle. The greater its mass, the shorter its life. The quantity of matter accessible in a star's nebula (the massive cloud of gas and dust from which it sprang) determines its mass. Gravity pulls the hydrogen gas in the nebula together over time, causing it to spin. The gas warms up and forms protostar as it spun faster.
When the temperature in the cloud's core reaches 15,000,000 degrees, nuclear fusion occurs. The cloud starts to glow brightly, contracts slightly and stabilizes. It will now became a main-sequence star and will continue to shine for millions to billions of years. Nuclear fusion converts hydrogen in the core of main sequence star into helium as it glows.
When the star's hydrogen supply runs out and can no longer generate heat through nuclear fusion, the core becomes unstable and contracts. The star's outer shell primarily made up of hydrogen, expands. It cools and glows red as it grows. The star then progresses to the stage of being a red giant. It's red because the outer shell has expanded outward, and it's a giant because it's cooler than it was in the main sequence star stage. Helium fuses into carbon in the red giant's core.
The core of low-mass stars collapse after the helium has fused into carbon and the outer layers of the stars are expelled . These outer layers combined to form a planetary nebula. Newly formed stars are almost entirely made up of hydrogen and helium, but as they progress, they produce heavier elements through nuclear fusion, which are eventually expelled by powerful stellar winds. These powerful winds recycle elements from planetary nebulae back into the interstellar medium.
If a red giant lacks the mass to generate the core temperatures needed to fuse carbon (roughly 1 billion K), an inert mass of carbon and oxygen will form at its core. After shedding its outer layers and forming a planetary nebula, such a star will leave behind a core, which is a white dwarf. When a white dwarf forms and no longer undergoes fusion reactions, it is extremely hot, but because it lacks an energy source, it will gradually cool as it radiates its energy away and converts to a black dwarf.
When stars 5 times the mass of our Sun or more reach the red giant phase, their core temperature rises as carbon atoms are formed from the fusion of helium atoms. As the temperature rises, fusion processes continues and gravity pulls carbon atoms, forming oxygen, nitrogen, and eventually iron.
Fusion in the core stops when the core is almost entirely made up of iron. Because iron is the most compact and stable of all the elements, breaking up the iron nucleus takes more energy than breaking up the nucleus of any other element. Therefore, creating heavier elements by fusing iron necessitates an energy input rather than a release of energy. Because energy is no longer radiated from the core, the star enters the final phase of gravitational collapse in less than a second. The core temperature rises to over 100 billion degrees as the iron atoms collide. The repulsive force between the nuclei overcomes gravity, and the core recoils in a shock wave, resulting in a supernova explosion.
The remnants of a large star that dies in a supernova explosion forms black hole. Nothing — not particles, not even electromagnetic radiation like light — can escape the gravitational pull of a black hole. (Smaller stars decay into dense neutron stars, which lack the mass to trap light.) It can be proven theoretically that no force can keep a star from collapsing under the influence of gravity if the star's total mass is large enough (roughly three times the mass of the Sun). Imagine a star ten times the mass of the Sun crammed into a sphere the size of New Delhi. As a result, nothing, not even light, can escape the gravitational field.
When a massive star runs out of fuel and collapses, neutron star is formed. The core, the most central part of the star, collapses, crushing every proton and electron into a neutron.
If the core of collapsing star has a mass between 1 to 3 times that of Sun, the newly created neutrons can stop the collapse and leave a neutron star behind. These are the most dense object known. One sugar cube of neutron star material would weigh about 1 trillion kilograms (or 1 billion tons) on Earth – about as much as a mountain.
A nebula is a cluster of interstellar clouds made up of cosmic dust, hydrogen, helium, molecular clouds, and possibly ionised gases. Again the gas, dust, and other materials "clump" together in these regions to form denser regions, which attract more matter and eventually become dense enough to form new stars. Planets and other planetary system objects are formed from the remaining material.