Phonons and related crystal properties from density-functional perturbation theory