The graviational potential at a point in space is the work done to move a unit mass from infinite (very far away) to the point in question. The gravitational potential V at a point outside a single spherically-symmetric planet is calculated by V = -GM/r, where G is Newton's gravitational constant = 6.67x10^-11 Nm^2kg^-2, M is the mass of the planet and r is the distance from the centre of the planet.
The escape velocity is the speed an object must have so that it can escape a planet's gravitational field from its surface. By conservation of energy, we know that KE1 + PE1 = KE2 + PE2 (KE = kinetic energy, PE = potential energy). The (gravitational) potential energy of an object is the gravitational potential multiplied by its mass (m), so PE = -GMm/r. It's kinetic energy is KE (1/2)mv^2, as usual. KE1 and PE1 are the energies at the surface of the planet (i.e. a distance r from its centre) while KE2 and PE2 are the energies at infinite distance. PE2 is 0 by definition, since no work is required to move the object to infinite from infinite. For the object to escape, KE2 must be at least 0 (not less than 0), so(1/2)m (v_esc)^2 + -GMm/r = 0 + 0This solves to v_esc = (2GM/r)^(1/2).