Hi Lexie,
The magnetic field of the Sun actually comes out in a big spiral called the Parker Spiral (
http://en.wikipedia.org/wiki/Parker_spiral). Because we can estimate how the Sun and Earth are connected from following the spiral, we know that if a CME erupts from a particular part of the Sun then its more likely to hit the Earth. (have a look at this computer simulation to see what I mean
http://www.youtube.com/watch?v=7L-YNGiCxXE). Like Emilia said, this is not the end of the story. There can be complications that we can't predict that may chance the path of a CME but this is certainly somewhere to start! Thats why last week there were so many nice aurorae. There was a Sunspot that was in the right location on the Sun that kept producing CMEs. Based on where on the Sun it was, the CMEs were mostly Earth directed.
Claire