|Diagram courtesy of NASA|
Gravity holds the Earth and other planets in orbit around the Sun. These orbits are elliptical. Comets sometimes have irregular orbits. Most comets are found in the Van Oort Belt. The comets with irregular orbits in which they swing close to the sun and soar far from the Van Oort Belt are the ones that have the head and tail that we see such as Halley's Comet. The long tail is due to some of the dirty ice that makes up a comet melts when the comet approaches the sun. Eventually a comet with an irregular orbit will totally melt and disappear. Although the orbit is irregular in respect to the Van Oort Belt, the orbit is still elliptical.
There are four fundamental forces. They are gravitational, electromagnetic, strong and weak forces. All four of them can be described mathematically. Of the four, gravitational manifests a continuous field. A goal of physics is to create a situation where all four fundamental forces unite to form one force.