  [Abridged] Recent studies revealed a strong correlation between the star
formation rate (SFR) and stellar mass of star-forming galaxies, the so-called
star-forming main sequence. An empirical modeling approach (2-SFM) which
distinguishes between the main sequence and rarer starburst galaxies is capable
of reproducing most statistical properties of infrared galaxies. In this paper,
we extend this approach by establishing a connection between stellar mass and
halo mass with the technique of abundance matching. Based on a few, simple
assumptions and a physically motivated formalism, our model successfully
predicts the (cross-)power spectra of the cosmic infrared background (CIB), the
cross-correlation between CIB and cosmic microwave background (CMB) lensing,
and the correlation functions of bright, resolved infrared galaxies measured by
Herschel, Planck, ACT and SPT. We use this model to infer the redshift
distribution these observables, as well as the level of correlation between
CIB-anisotropies at different wavelengths. We also predict that more than 90%
of cosmic star formation activity occurs in halos with masses between 10^11.5
and 10^13.5 Msun. Taking into account subsequent mass growth of halos, this
implies that the majority of stars were initially (at z>3) formed in the
progenitors of clusters, then in groups at 0.5<z<3 and finally in
Milky-Way-like halos at z<0.5. At all redshifts, the dominant contribution to
the star formation rate density stems from halos of mass ~10^12 Msun, in which
the instantaneous star formation efficiency is maximal (~70%). The strong
redshift-evolution of SFR in the galaxies that dominate the CIB is thus
plausibly driven by increased accretion from the cosmic web onto halos of this
characteristic mass scale. Material available at
http://irfu.cea.fr/Sap/Phocea/Page/index.php?id=537.
