Theoretically, planets would have an approximately equal chance of going one way in their orbit or another but in reality, this is not the case (at least in our solar system). Why is this? 
The same reason (almost) all of them rotate in the same direction: because of the conservation of angular momentum.

Before a star and its planets exist, there’s just a cloud of disorganized gas and small molecules. The Solar System formed from such a cloud around 4.6 billion years ago. 

On that scale, there is some small amount of rotation within the cloud. It could be caused by the gravity of nearby stellar objects, local differences in mass as the cloud churns, or even the impact of a distant supernova. The point is, all molecular clouds have at least a little rotation.

In a large system like a molecular cloud, each particle has some angular momentum, and it all adds together across a very wide area. That’s a lot of momentum, and it is conserved as the cloud continues to collapse under its own gravity. That angular momentum also flattens the cloud, which is the reason why the Solar System is near-planar.



When the cloud finally collapses, it forms a star and shortly after planets. However, angular momentum is always conserved. That's why planets all follow the same orbit, and why almost all of them rotate in the same direction. There's nothing to turn them the other direction, so they will continue spinning in the same direction as the original gas cloud.

There are a few exceptions, though. Whenever objects formed in such a way that sent them orbiting the opposite direction, they usually collided with objects going in the same direction as the original cloud. This destroyed any outlying objects or sent them in the same direction as the original cloud.

Still, two huge exceptions are planets Venus and Uranus. Uranus spins on an axis of almost 90-degrees (on its side). Venus meanwhile spins the opposite direction as Earth and the other planets.

In both cases there is strong evidence that these planets were struck by large objects at some point in the distant past. The impacts were large enough to overcome the angular momentum of the bodies, and give them a different spin. There are also a range of other theories; for example, some astronomers think that Venus may have been flipped upside-down. Point is, there were irregular events that happened to both of these planets.
