The sun and the earth are not the only sources of gravity. Everything in space has its own gravity. Large objects like planets have stronger gravity, and small objects like meteors have weaker gravity. So just as earth's gravity holds the moon in position, the moon's gravity holds in place a spaceship that lands on the moon. The moon is smaller than the earth, so the pull of its gravity is weaker than that of the earth.
Satellites do many things for people.
Their most important job is helping people communicate with other people, wherever they are in the world. A satellite can carry a camera as it travels in its orbit and take pictures of the whole earth. Mapmakers can use these pictures to make more accurate maps. Satellite pictures can also help experts predict the weather, because from the satellite, the camera can actually see the weather coming. When you watch the weather forecast on TV, you are seeing pictures of the earth taken by a camera riding on a satellite.