Abstract
We describe all pseudo-Riemannian metrics on closed surfaces whose geodesic flows admit nontrivial integrals quadratic in momenta. As an application, we solve the Beltrami problem on closed surfaces, prove the nonexistence of quadratically-superintegrable metrics of nonconstant curvature on closed surfaces, and prove the two-dimensional pseudo-Riemannian version of the projective Obata conjecture.