How can we know that Halley's Comet is going to come again every 76 years? I understand that the comet has an orbit around the sun but how can scientists know that it won't be thrown off course for example by passing Jupiter and Jupiters gravity giving it a tug in a different direction? Its not a very big object in space so it seems to me that its orbit could be changed very easily.
Each time Halley's comet passes us, we can make a pretty good estimate of its current orbit, and determine how close it will get to the massive bodies of the solar system like Jupiter, Saturn, Uranus, or Neptune on its next orbit. We can make good estimates of gravitational perturbation effects, and thereby know where to look for it.
In fact, astronomers have been doing exactly that for centuries with remarkable accuracy:
Halley thus concluded that all three comets were, in fact, the same object returning every 76 years, a period that has since been amended to every 75–76 years. After a rough estimate of the perturbations the comet would sustain from the gravitational attraction of the planets, he predicted its return for 1758.
Halley's prediction of the comet's return proved to be correct, although it was not seen until 25 December 1758, by Johann Georg Palitzsch, a German farmer and amateur astronomer. It did not pass through its perihelion until 13 March 1759, the attraction of Jupiter and Saturn having caused a retardation of 618 days. This effect was computed prior to its return (with a one-month error to 13 April) by a team of three French mathematicians, Alexis Clairaut, Joseph Lalande, and Nicole-Reine Lepaute.
However, Halley's position turns out to be hard to predict for time scales much beyond that of a single orbit; over the long term, the orbit is chaotically unstable and it's possible that it will collide with a planet, or be ejected from the solar system, within some hundreds of thousands of years.
Its not a very big object in space so it seems to me that its orbit could be changed very easily.
As it turns out, the mass of an object in space doesn't affect how the gravity of other bodies changes its trajectory. A feather, a baseball, a comet, and a small moon making a close flyby of Jupiter along the same trajectory, one after another, will all exit Jupiter's neighborhood in the same direction and at the same speed. The small moon will have more effect on Jupiter than the feather will, but aside from that there's no difference.