The potential energy of an object of mass m at a distance R from the center of a body of mass M is $U = -\frac{GMm}{R}$. The kinetic energy is $K = \frac{1}{2}mV_e^2$. For the object to escape, its total mechanical energy must be at least zero at infinity, i.e., $\frac{1}{2}mV_e^2 - \frac{GMm} {R} \ge 0$. The minimum velocity occurs when the equality holds: $\frac{1}{2}mV_e^2 = \frac{GMm}{R}$. This simplifies to $V_e^2 = \frac{2GM}{R}$. Since $GM = gR^2$, substituting this gives $V_e^2 = \frac{2(gR^2)}{R} = 2gR$. Therefore, $V_e = \sqrt{2gR}$.