One component of comet motion is that:

Comets expel dust and gas, usually from localized regions, on the sun ward side of the nucleus. This action causes a reaction by the cometary nucleus, slightly speeding it up or slowing it down.

The main contributing factor to a comet's motion is due to gravitational pull:

The Sun's pull is the largest by far, unless one body approaches very closely to another, so orbit calculations usually are carried out as two-body calculations with the sun as one of the bodies in question, with small added effects due to the pull of other bodies.

The comets appear to follow an elliptical path or orbit about the Sun, which is at one focus of the ellipse. Their farthest point from the Sun (their aphelion) is near Jupiter's orbit, with the closest point (perihelion) being much nearer to Earth. Comets, have very large eccentricities(which is the measure of departure from circularity), often approaching one, the value for a parabola. For example: The Kreutz family is the name given to many comets which closely approach the Sun from one direction in space. They always approach the Sun to within 3 million kilometers (1.9 million miles) or less, and some have actually hit the Sun.

Predicted return of a comet:

In 1705 Halley noted in his original paper predicting the return of his comet that Jupiter undoubtedly had serious effects on the comet's motion, and he presumed Jupiter to be the cause of changes in the period (the time required for one complete revolution about the Sun) of the comet. (Comet Halley's period is usually stated to be 76 years, but in fact it has varied between 74.4 and 79.2 years during the past 2,000 years.) In that same paper, Halley also became the first to note the very real possibility of the collision of comets with planets.

Where are they:

NASA's Hubble Space Telescope has detected a long-sought population of comets dwelling at the icy fringe of the solar system Based on the Hubble observations, astronomers estimate the belt contains at least 200 million comets that have remained essentially unchanged since the birth of the solar system 4.5 billion years ago. The region is thought to be the source of the comet that struck Jupiter in July 1994. The original theory was derived by Gerard Kuiper, and so-named Kuiper Belt.

The team believes this apparently closes the mystery of the source of the short-period comets that orbit the Sun in less than 200 years, including such members as comet Encke and the infamous comet Shoemaker-Levy 9 that collided with the planet Jupiter in July 1994.