X-ray binaries is one of the few probes to study the populations of compact objects and the formation of compact-object mergers (e.g. gravitational-wave sources, and/or short GRBs). However, constraining the demographics of compact objects, and the complex formation and evolution channels of X-ray binary systems relies on the characterization of their donor stars and compact objects. Determining the nature of the donor stars in X-ray binary systems allows us to identify their parent stellar populations and measure directly their formation efficiency as function of their age, a key parameter for testing X-ray binary formation and evolution models. Combining this information with constraints on the nature of their compact objects allows us to for the first time to explore their their demographics in different galactic environments.
I will discuss results from Chandra-based studies of the formation efficiency of X-ray binaries in nearby galaxies, and a systematic study of the compact object populations in nearby galaxies observed with NuSTAR. We find that High-mass X-ray binaries show enhanced formation rates at ages of ~30-60Myr, with another possible peak around 10Myr, in good agreement with expectations from X-ray binary population synthesis models. Our analysis of the compact-object populations indicates that more actively star-forming galaxies host a larger fraction of black-hole systems. Furthermore, we see a clear preference for accreting pulsars to be associated with star-forming regions, in accordance with similar studies in our Galaxy. Finally, we compare these results with predictions from population synthesis models for different star-formation scenarios.