Making the best of cosmological perturbations: theory and data analysis