v = (GM/r)^1/2 describes the velocity needed to orbit the Earth at a radius r, where r is measured from the center of the Earth. "Escaping" in this context means "becoming a satellite."
Another way I have seen "escaping" defined is getting infinitely far from the Earth, in which case the gravitational pull of the Earth on the escaped object is zero because F = GMm/r^2, and as r goes to infinity, F goes to zero. U = -GMm/r, where U is gravitational potential energy. The largest value of U is zero and this value is attained when a body is infinitely far away from the Earth. In order to get infinitely far away from the earth, an object needs to have enough kinetic energy (and therefore enough velocity) and as it is getting further away from the earth, its KE is being converted to U.
I don't think it's correct to use mg in escape velocity problems because g is just an approximation for cases when a body is close to the surface of the Earth.
Anyhow, perhaps someone with a good understanding of this can post more (and/or correct me if I am wrong)