Variational Methods in Lorentzian Geometry