Please read Stars are like factories, Big Bang nucleosynthesis and Nova and SuperNova before or in conjunction with this article.
InterStellar Medium & Molecular clouds
Now let me tell you something about the stars. Stars form inside dark, cold molecular clouds. Stars usually form in clusters from clouds found in the spiral arms of galaxies from Material called InterStellar Medium, which is mostly hydrogen neutral and ionized, helium, dust particles surrounded by frozen water & other stuff like carbon, nitrogen, etc. Stars usually form in giant molecular clouds 50-200 Light Year across which are very cold at 10 Kelvin, i.e.-263 celsius & have a density of 10-1000 atoms/cm3. To form a star this need to be shrunk down to increase the density by 10 power 20 times.
Size doesn’t matter
Protostars are stars in the process of creation. The larger the mass of a Protostar the shorter the time it takes to contract & form a star. Our sun took almost 300million years. Size does matter may be everywhere else but not in the case of stars. Greater the mass of a star, less is its lifespan as a main sequence star and lesser the mass, more is the lifespan. Thus a star having a mass 40 times more than the mass of Sun has Main Sequence age of 1 million years and a star having a mass less than half of sun has an age of almost 200 billion years. Very low mass stars less than 0.08 of the mass of sun are never be able to reach temperatures in their cores to start burning hydrogen. They produce little energy only by gravitational collapse and are called Brown Dwarfs.
Fusion vs Fission
Stars give light and heat through nuclear fusion of hydrogen atoms into helium in their dense core region. There are two known sets of fusion reactions by which stars convert hydrogen to helium. Stars with mass like that of sun and less use the proton-proton chain reaction while Stars that are bigger than sun use CNO (carbon-nitrogen-oxygen) cycle. In nuclear bombs, the process we use is Fission and is different from Fusion which is happening in stars. Although in hydrogen bombs we use a combination of both to some extent. Both fission and fusion are nuclear processes by which atoms are altered to create energy. Fission is the division of one atom into two, and fusion is the joining of two lighter atoms into a larger one. Fission is used in nuclear power plants as it can be controlled, while fusion is not used to produce power since the reaction is not easily controlled and is expensive to create the needed conditions. So Fission is not as much difficult as fusion is. For fission if you get some uranium-235 and shoot a neutron at it, the uranium absorbs the neutron and becomes uranium-236. But, this uranium-236 is unstable and will break into pieces to give you energy. Plus it also creates extra neutrons to break apart even more uranium. This can also be done with plutonium and thorium.
How stars produce heat and light
On the other hand fusion in stars start because of the contraction of the mass towards the center of the star due to gravity. Gas and dust progress and the temperature reaches 15 million degrees while the pressure at the center of the star becomes enormous. The electrons are torn off of their parent atoms, creating a plasma. The contraction proceeds and the nuclei in the plasma start moving faster and faster. Ultimately, they approach each other so fast that they overcome the electrical repulsion that exists between their protons. The nuclei crash into each other so hard that they unite together, or fuse. In doing so, they give off a great deal of energy. This energy from fusion flows out from the center, setting up an outward pressure in the gas around it that balances the inward pull of gravity. When the released energy reaches the outer layers of the ball of gas and dust, it moves off into space in the form of electromagnetic radiation and the star begins to shine.
Sun and stars actually breathe and their life depend on this
During this stage of the star’s lifetime, it is located on the main sequence at a position determined mainly by its mass, but also based upon its chemical composition and other factors. All main-sequence stars are in hydrostatic equilibrium, where outward thermal pressure from the hot core is balanced by the inward pressure of gravitational collapse from the overlying layers.
Without Hydrostatic equilibrium Star would finish itself in few hours just like a candle in our homes.
During their lives, stars fight the inward pull of the force of gravity. It is only the outward pressure created by the nuclear reactions pushing away from the star’s core that keeps the star intact, alive and burning. If it is not so the star would finish itself in few hours regardless of the amount of fuel and its size, just like a candle in our homes.
This expansion and contraction of the star is actually its life, and if it stops, it will be like ending of the rhythm of breathing as in the living beings. O people your sun and stars actually breathe and their life depend on this. O mankind stars life is a continual competition between gravitational collapse inward and gas pressure radiating & pushing outward causing expansion. Collapsing causes the star to heat up, and expansion makes the star to cool down. Hydrostatic equilibrium occurs when the two conditions are equal & opposite.