I understand that in electrostatics all charges are 'static' due to equal forces acting upon them. This then leads to the fact that the arising electric field must be perpendicular to the metals surface at the surface. What i don't understand is what force is counteracting the electric field. I have read that there is a potential well but am not sure how this works. Could someone point me in the right direction? Thanks.
Are you aware of the quantum mechanical solution for the atoms? That the charges of the nucleus and the electrons can be represented by a potential well in the Schrodinger equation and the solutions have specific energy levels for the electrons, which stay attached to the atoms unless a photon of specific energy kicks them out? The electrons cannot exit the atom but reside in orbitals about the nucleus. The "force" comes from the electric field of the charges , but the solutions are stable.
In an analogous way because of the electronic structure of the metal atoms, the lattice of the atoms has a collective electric potential that gives collective energy levels for the electrons to reside in stable energy bands .These energy levels have small energy differences, but allow each electron in a different level, as is necessary from its spin 1/2, where two electrons cannot occupy the same energy level. Nevertheless they are bound by the collective potential in a similar way as the electron around the proton in the hydrogen atom.
See also my answer to a similar question here.