Planets and stars circle around one common centre of gravity. So the moon orbits the earth, the earth orbits the sun, the sun orbits the blackhole in the middle of our galaxy then you extrapolate outwards.
The direction in which they orbit is leftover angular momentum from a supernova or big explosion.
Most of the planets in our solar system rotate counter clockwise except for Venus.
Uranus was knocked on its side by a large object, could have been planet X or Thea. Thea is the object that knocked into Earth during its Hadean phase and created the moon.
The planets are where they are because of Jupiter. And Jupiter is the reason Mars is half the size of earth. When Jupiter moved in towards the Sun from the outer solar system it absorbed all the dust and rocky bits floating around. So mars didnt get to form properly.
Lastly Jupiter protects earth from asteroids and large astronomical bodies hitting the earth, due to its size large bodies in space are more gravitationally attracted to it.