The Oort cloud

In 1950 Jan Oort noticed that no comet had been observed coming from interstellar space. Instead, all long period comets, normally have orbits that lie at a great distance and have no preferential direction. For these reasons he deduced the existence of a vast cloud of comets, named the Oort cloud, with the shape of a diffuse spherical shell at about 50,000 AU from the Sun (which is about 1/5 of the distance to Alpha Centauri, the nearest star).
The statistics imply that this cloud, which surrounds the entire solar system, could contain perhaps up to objects. In this hypothesis, the Oort Cloud may account for a significant fraction of the mass of the solar system (perhaps even more than Jupiter itself). Unfortunately, since the individual comets are so small and at such large distances, scientists have only very little evidence about the Oort Cloud.

Image courtesy of The Electronic Universe Project

Why do comets leave the Oort Cloud?

Some of the comets that inhabit the Oort cloud, can, from time to time, fall into the inner solar system and come under the gravitational control of the planets, becoming long period comets. But which are the physical mechanisms that can actually make comets leave the Oort cloud pulling them inside the inner solar system, or ejecting them to interstellar space?
First of all, comets of the Oort Cloud can be perturbed by the gravity of passing stars. In fact, all the stars in the disk of the Milky Way share a common motion around the center of the  galaxy but also move relative to each other. Stars approach from random directions, so the velocity changes are sometimes positive, sometimes negative. The combined effect is a chaotic perturbation of the velocity (with more precision, a "random walk") such that, after 10,000 stars have passed by, the original orbit of the comet has been drastically altered.
How long does this take? The answer depends on where in the Oort Cloud the comet comes from. In fact, most of the comets are thought to come from the outer edge of the cloud, where the attraction to the sun is weak and passing stars have bigger effects. Closer to the sun, the comets are tightly held and may never be dislodged by the gravity of passing stars.
Other Perturbations might occur, such as the  gravity of the Milky Way disk itself that can disturb the orbits of comets in the Oort Cloud, with an effect comparable in size to that of passing stars.
Also the sun may disturb the Oort Cloud's objects (on very rare occasions, when passing through a Giant Molecular Cloud) causing a shower of comets to rain on the inner planetary system. Another possible mechanism to make comets leave the Oort cloud can be the shock wave from an explosive event such as a supernova.