Every object (with mass) is attracted to every other object in the universe by the force of gravity. This force is proportional to the mass of the objects, and inversely proportional to the square of the distance between the objects:
F = G*(m1)*(m2)/r^2
"Force equals G (the Gravitational Constant,) multiplied by the mass of the two objects, and divided by the square of the distance between them." Now, we also know that:
F = m*a
"Force equals mass times acceleration." Using these two equations we can, for example, determine the acceleration imposed by one object on another:
F = (m2)*a = G*(m1)*(m2)/r^2 a = G*(m1)/r^2
Note: The mass of an object has no effect on the acceleration it feels! It cancels out.
Now, if we apply this equation using the values present on the surface of the Earth (mass = 6.02e24kg, radius = 6400km)...
a = (6.67259e-11)*(6.02e24kg)/(6400000m)^2 = 9.81m/s^2
We get , the correct value for acceleration due to gravity on the Earth's surface! For situations directly on the surface of the Earth (or close to it, ie. In the sky), we can assume that this acceleration will bring objects back down to the surface. When we're in distant space, however, since the Earth's mass acts as though it were exerting gravity from a point (its center of mass), it is now possible to fall around the Earth, ORBIT!
Click here to download example source code demonstrating how to cope with both of these situations.