How does gravity keep the planets in motion around a star?

2 answers

Let:
Star = Sun
Planets = Earth

It's much simpler to understand the question with what we know.

Now to answer your question:
The gravity of the Sun keeps the earth in it's orbit. This is also true as the Moon orbits the Earth because of the pull of Earth's gravity, the Earth orbits the Sun because of the pull of the Sun's gravity.

Why doesn't the earth just fall into the sun?
Velocity. Earth has it's own velocity, without the sun we would travel in a straight line, due to the sun and it's gravitational pull we don't, instead we go around the sun (we orbit the sun).

This applies to much more that just our star (sun) and our planet (earth). It applies to nearly every solar system out there.

Best of luck,
Ben
I would add that the force of gravity provides exactly the inward directed force required to keep the planet going in a circle. This is just like the tension in a string needed to swing a ball in a circle around you.