Surface properties of simple metals via inhomogeneous linear electronic response. I. Theory