In earlier days people believed that the stars are immortal, later scientific studies and discoveries found that the stars are not immortal it has a birth and a death. Then how do the stars are born?
         
            A birth of a star takes millions of years,the stars are  born in a galactic womb called nabule (large molecular clouds), nabule is a large cloud of dust & gas, it contains molecules like hydrogen & helium,due to some gravitational disturbance gravity starts to pull molecules together,as more and more gases are pulled more and more dense it is, when density increases temperature increases. It is called a protostar.
The image above shows a nabula called Pillars of Creation which is about 7000 light years away from Earth

    The protostar gathers more and more mass ,when it reaches to a certain temperature about 18million degrees hydrogen is fused to form helium know as nucleosynthesis or nuclear fusion, when hydrogen is fused to form helium it releases a huge amount of energy in the form of heat,light and radiation. At  the time of nuclear fusion the inward force of gravity is equal to the outward force created by heat and radiation, when inward and outward force are balanced a star is formed. The fusion continues for millions of years hydrogen to helium, helium to lithium and so on, when it reaches to iorn  the fusion will not provide enough energy to balance the force,the death of a star begins there but thats a topic for another chapter.