We explore the dynamics and evolution of the Universe at early and late times, focusing on both dark energy and extended gravity models and their astrophysical and cosmological consequences. Modified theories of gravity not only provide an alternative explanation for the recent expansion history of the universe, but they also offer a paradigm fundamentally distinct from the simplest dark energy models of cosmic acceleration. In this review, we perform a detailed theoretical and phenomenological analysis of different modified gravity models and investigate their consistency. We also consider the cosmological implications of well motivated physical models of the early universe with a particular emphasis on inflation and topological defects. Astrophysical and cosmological tests over a wide range of scales, from the solar system to the observable horizon, severely restrict the allowed models of the Universe. Here, we review several observational probes—including gravitational lensing, galaxy clusters, cosmic microwave background temperature and polarization, supernova and baryon acoustic oscillations measurements—and their relevance in constraining our cosmological description of the Universe.