Context. Massive stars play a dominant role in the process of clustered star formation, with their feedback into the molecular cloud through ionizing radiation, stellar winds, and outflows. The... Show moreContext. Massive stars play a dominant role in the process of clustered star formation, with their feedback into the molecular cloud through ionizing radiation, stellar winds, and outflows. The formation process of massive stars is poorly constrained because of their scarcity, the short formation timescale, and obscuration. By obtaining a census of the newly formed stellar population, the star formation history of the young cluster and the role of the massive stars within it can be unraveled. Aims: We aim to reconstruct the formation history of the young stellar population of the massive star-forming region RCW 36. We study several dozen individual objects, both photometrically and spectroscopically, looking for signs of multiple generations of young stars and investigating the role of the massive stars in this process. Methods: We obtain a census of the physical parameters and evolutionary status of the young stellar population. Using a combination of near-infrared photometry and spectroscopy we estimate the ages and masses of individual objects. We identify the population of embedded young stellar objects (YSOs) by their infrared colors and emission line spectra. Results: RCW 36 harbors a stellar population of massive and intermediate-mass stars located around the center of the cluster. Class 0/I and II sources are found throughout the cluster. The central population has a median age of 1.1 {plusmn} 0.6 Myr. Of the stars that could be classified, the most massive ones are situated in the center of the cluster. The central cluster is surrounded by filamentary cloud structures; within these, some embedded and accreting YSOs are found. Conclusions: Our age determination is consistent with the filamentary structures having been shaped by the ionizing radiation and stellar winds of the central massive stars. The formation of a new generation of stars is ongoing, as demonstrated by the presence of embedded protostellar clumps and two exposed protostellar jets. Based on observations performed with the ESO New Technology Telescope at La Silla Observatory, as part of program 074.C-0728, and with the ESO Very Large Telescope on Cerro Paranal, Chile, as part of programs 078.C-0780, 084.C-0604, and 087.C-0442.Appendices are available in electronic form at http://www.aanda.orgShow less