My limited understanding of stellar formation is that a gas cloud condenses enough that various forces (just gravity?) eventually lead to enough pressure to ignite nuclear fusion. However, since stars vary vastly in size it got me thinking: Do young, large stars ignite as smaller stars and then continue to pull material in until they become large, young stars? Or, are they composed of less dense elements or something so that they will only ignite when they are already much larger than stars destined to start and stay small?
Soon after a star begins shining from collapse and then nuclear burning at its core, while still on the pre-main-sequence track, stellar winds and radiation pressure blow away the surrounding gas. The more massive stars have stronger radiation pressure, the low mass stars have powerful winds. Planets and a rocky disk may remain, but the mass of the star ceases to increase significantly.
The initial cloud is typically many times the final mass of a star. As it collapses it fragments into smaller and smaller subclumps and these form single, binary or triple stars etc. But to fully collapse, most of the angular momentum must be transferred away from the proto-stars. It is thought that magnetic fields send the majority of the mass of a subclump outwards while allowing the inner region to spin down (or not as far up). The stellar winds and radiation pressure remove the gas in the proto-planetary disk plus the outer region gas with the angular momentum. The stellar component of the cluster is responsible for unbinding a large fraction of the mass of the cloud and resulting in the low star formation efficiencies of clouds.
The mass of the star is essentially set already by the initial collapsing gas cloud. It is the single most important parameter determining the structure and evolution of the star. And stars ignite already before nuclear fusion starts, simply due to conversion of gravitational potential energy into kinetic energy of the gas, which causes atoms to emit light. The higher the mass of the star the higher the potential energy and the brighter the star will be.