This thesis presents several significant new results that shed light on two major puzzles of modern cosmology: the nature of inflation, the very early phase of the universe that is thought to have given rise to the large-scale structures that we observe today; and that of the current accelerated expansion. In particular, it develops a clean method for characterizing linear cosmological perturbations for general theories where gravity is modified and/or affected by a new component, called dark energy, responsible for the accelerated expansion. It proposes a new extension to what was long thought to be the most general scalar field theories devoid of instabilities, and demonstrates the robustness of the relation between the energy scale of inflation and the predicted amplitude of gravitational waves. Finally, it consolidates a set of consistency relations between correlation functions of the cosmological density field and investigates the phenomenological consequences of their potential violation. Presented in a clear, succinct and rigorous style, each of these original results is both profound and important and will leave a deep mark on the field.