Stellar nursery LH 95 in the Large Magellanic Cloud.
Turbulence forms deep within a cloud of dust, causing “knots” with enough mass to make the gas and dust collapse under its own gravitational attraction. This is the beginning of the birth of a star.
As the cloud collapses (not always at a steady pace), the material at its centre begins to heat up. This is a protostar, and it will eventaully become a star. The protostar begins to gather dust and gas, not all of which will end up as part of the star. It takes a star the size of the Sun about 50 million years to mature to adulthood from the beginning of the collapse.
A star is fuelled by the fusion of hydrogen to helium deep within its interior. Energy flows outwards, which makes the star shine, and also prevents it from collapsing inwards under its own weight.