Numerical simulations have become a powerful tool to study cosmological structure formation.
In this talk, I will first show how the initial conditions can affect the results at low redshift, and introduce
the Horizon Run 4 (HR4), a massive cosmological N-body simulation. I will then discuss the rate of halo interactions and the alignment of halo pairs as a function of the environment using the HR4.
I will then move on to cosmology beyond LCDM, and study the alignment of dark matter haloes in
modified gravity and dark energy models. I will also assess the potential of the large-scale structure of the Universe to constrain early-Universe models that are undistinguishable from the CMB.
Finally, I will discuss how to reconstruct model-independently the luminosity distance from supernovae,
and combine them with BAO measurement from BOSS DR12, to test the FLRW metric and the flatness
of the Universe.