ABSTRACT Stars form in dense, clustered environments, where feedback from newly formed stars eventually ejects the gas, terminating star formation and leaving behind one or more star clusters. Using the STARFORGE simulations, it is possible to simulate this process in its entirety within a molecular cloud, while explicitly evolving the gas radiation and magnetic fields and following the formation of individual, low-mass stars. We find that individual star-formation sites merge to form ever larger structures, while still accreting gas. Thus clusters are assembled through a series of mergers. During the cluster assembly process, a small fraction of stars are ejected from their clusters; we find no significant difference between the mass distribution of the ejected stellar population and that of stars inside clusters. The star-formation sites that are the building blocks of clusters start out mass segregated with one or a few massive stars at their centre. As they merge the newly formed clusters maintain this feature, causing them to have mass-segregated substructures without themselves being centrally condensed. The merged clusters relax to a centrally condensed mass-segregated configuration through dynamical interactions between their members, but this process does not finish before feedback expels the remaining gas from the cluster. In the simulated runs, the gas-free clusters then become unbound and breakup. We find that turbulent driving and a periodic cloud geometry can significantly reduce clustering and prevent gas expulsion. Meanwhile, the initial surface density and level of turbulence have little qualitative effect on cluster evolution, despite the significantly different star formation histories.