Star Formation

Credit: T.A. Rector/University of Alaska Anchorage,
T. Abbott and NOAO/AURA/NSF
Stars are not true stars until they can fuse hydrogen into helium. Before that point, they are called 'protostars'.
The sudden burst of light made by a new star blows away much of the nearby gas cloud, but it can leave just enough material behind to form a number of planets later on.
You can see what is happening in a bit more detail in this simulation.
At this point the star becomes relatively stable, with the outward pressure from nuclear reactions balancing the inward pull of gravity.
A typical star like the Sun will live for around 10 billion years, until it eventually runs out of fuel. All stars go through a life cycle in the same way that we do - they just live longer. When they eventually run out of fuel, they will end their days in spectacular fashion.