Why free electrons do not leave the surface of metal? In metals free electrons can move freely over the whole piece of metal, but they do not leave it.  Moreover in electrified metals the extra electrons are located near the surface of the metal, but do not leave it.  

What forces prevent free electrons to leave the metal?

ADDED. Consider for simplicity an electrified metal ball. All its charge is homogeneously distributed over its surface.  The interior part is neutral.  The charges on the surface repel from each other. By symmetry considerations, the total force acting on a point charge on the surface has radial direction.  It is also clear the force is non-zero and has outward direction. Nevertheless the charge does not leave the surface.  WHY?
 A: Electrons in a metal are attracted to positively charged ions. In other words, it is the same reason for which electrons do not leave an atom, although here we have many atoms and many electrons, and the fact that the electrons are free to move is what holds the atoms together (metallic bond). Extracting an electron from a metal requires energy, which is characterized by work function.
"Free" electrons
Thus, what holds electrons in metal is the Coulomb attraction to the positively charged ions. This means, of course, that the electrons are not really free: in fact, their states are Bloch waves, whose envelope function is a plane wave, and which resemble free electrons in the effective mass approximation. This means that their momentum and mass are not those of free electrons. Furthermore, there is also electron-electron interaction, but the Fermi liquid theory tells is that the electrons still can be treated as free, given further appropriate renormalizations (although in 1D or at low densities this picture breaks).
Metal stability
In fact, the Coulomb forces alone could not be able to hold the metal together. Indeed, in an electrically neutral metal the electrons would spread to screen exactly the charge of the ions, so that the work for adding or removing an electron would be zero. Moreover, Earnshow's theorem tells us that a system of charges held together by purely Coulomb forces could not be stable.
The solution lies in the exchange interaction. I quote here a simplified discussion from Chapter 3 of Fetter&Walecka's book, whereas more detailed description should be available in the Kittel's "Quantum theory of solids". In a fully quantum mechanical calculation, after the Coulomb interactions between the electrons and the ions and other electrons have been accounted for, we are left with the following contribution:

where $r_s$ is the ratio of the inter-particle spacing to the Bohr radius:
$$r_s = \frac{r_0}{a_0}, V = \frac{4}{3}\pi r_0^3N, a_0 =\frac{\hbar^2}{me^2}.$$
The first (positive) term in the energy describes the kinetic energy of the electrons, whereas the second (negative) term is due to the exchange interaction. The energy has a minimum, where the two terms balance each other and the electron gas becomes stable, as seen in this figure:

