Star lifecycle
The very beginning of a star is when gravity gathers materials and matter to form a dense, swirling cloud consisting of gas and dust called a nebula. The ultra-violet radiation inside these interstellar gas clouds makes the gas glow spectacular, unearthly colours, however, there can also be dark nebulas. Inside the gas columns of the nebula is where stars are believed to begin forming. This happens when the gravitational pulls in the gas cloud cause the denser parts to compress and contract becoming indistinct shapes of matter in the the nebula. These formations then heat to around 10 billion degrees (10 000 000 000°C) due to the potential gravitational energy becoming thermal energy, which causes materials to collapse in on themselves and compress into a spherical form. This stage is a protostar. As this is happening, the high internal pressures from the star are trying to expand it and the external gravity is trying to compress it to a single point. Eventually, the core of the star becomes so hot and compressed that the nuclear fusion process begins. This is where hydrogen is converted to helium giving the star the fuel it needs to emit blinding light and burning heat. This is when a protostar becomes a star.
While a star is 'living' it will burn through all of its hydrogen stores, the core contracts, the outer layers will expand and the surface temperature will decrease. The length of a star's life depends on how long these occurrences last. This in turn depends on whether it is a large, medium (mainstream) or small star. In other words the length of a star's life depends on its mass. Large stars last for only a few million years as, since it is so large, it needs more fuel at one time to continue giving off energy, therefore burning through its hydrogen faster and having a shorter life. A medium or mainstream star (like our Sun) will burn steadily for approximately 10 billion years, using up its hydrogen at a measured pace. Small stars are the longest living stars that can last up to 10 trillion years (10 000 000 000 000). Also known as red dwarfs, these stars can be anywhere from 7.5% the mass of the Sun to 50%. Red dwarfs do not have radiative zones, so they use up all of their hydrogen not just the hydrogen at the core. The universal formula for the conversion of mass to energy is:
E=mc² (Energy=mass times by the speed of light).
Each size star ends its life in a different way. At the end of its life, a small star will become a white dwarf and planetary nebula. A white dwarf is what a star becomes when it has no more hydrogen to use up. It is simply the left over heavier elements (core) with the remaining heat trapped inside turning the star white. The matter of a white dwarf becomes so heavy that a tablespoon on Earth would add up to 1 tonne. It emits heat through radiation of energy. Planetary nebulas are the outer layer materials that are thrown off when the star shrinks to form a white dwarf. When gravity forces the inner star to condense, The high temperature of the central area (white dwarf) drives the outer part of the star away in a stellar wind. The heat from the white dwarf is what causes the planetary nebula to glow. After this stage, the remaining heat from the small star will fade from the white dwarf and it will form a black dwarf. Black dwarfs are the hypothetical, invisible endings to white dwarfs, and the final resting form of dead stars. It is the version of a white dwarf that has emitted all of the remaining heat from the original star through radiation of energy.
A medium sized star will end its life in a slightly different way to a small star. Once its hydrogen has burnt out the mainstream star's helium core begins to contract and the outer layers further cool and expand forming a red giant. This enables helium fusion, whereas earlier in its life the star was unable to burn this element. When the helium is burning the star will either: form a smaller version of this (small red giant) until the helium has run out, then it will become a regular red giant again and eventually a white dwarf and planetary nebula, or it will go straight to forming the white dwarf and planetary nebula.
Large stars will form super red giants when they have run out of hydrogen and smaller red giants when they have run out of helium, however, from there the heavier element of carbon burns in the core and it again forms a red giant. After this, either the iron then the heavier elements in the star burn and it proceeds back to a small red giant, or the core of the star implodes which may cause a supernova. The reactions that happen in the process of the carbon burning, occur so quickly that the star explodes, this is called a supernova. When carbon burns it forms iron, which stops the process of fusion and releasing energy so that the star collapses in on itself. The outer layers are violently blown into space and the core is crushed to immense compactness. After this has happened the remains will either form a white dwarf, a neutron star or a black hole. The neutron star is formed in the moment before total collapse when there is an unexpected increase in temperature, density and pressure, further compacting the core which forms a spinning ball of neutrons. Black holes are formed from the largest mass stars and has a core that shrinks down to a point. In these stars of huge mass there is no outward force that can resist gravity and the star continues to collapse and form a dense substance which not even light can escape.