Black holes are the evolutionary endpoints of stars at least 10 to 15 times as massive as the Sun. If a star that massive or larger undergoes a supernova explosion, it may leave behind a fairly massive burned out stellar remnant. With no outward forces to oppose gravitational forces, the remnant will collapse in on itself. The star eventually collapses to the point of zero volume and infinite density, creating what is known as a " singularity ". As the density increases, the path of light rays emitted from the star are bent and eventually wrapped irrevocably around the star. Any emitted photons are trapped into an orbit by the intense gravitational field; they will never leave it. Because no light escapes after the star reaches this infinite density, it is called a black hole.
But contrary to popular myth, a black hole is not a cosmic vacuum cleaner. If our Sun was suddenly replaced with a black hole of the same mass, the Earth's orbit around the Sun would be unchanged. (Of course the Earth's temperature would change, and there would be no solar wind or solar magnetic storms affecting us.) To be "sucked" into a black hole, one has to cross inside the Schwarzschild radius. At this radius, the escape speed is equal to the speed of light and once light passes through, even it cannot escape.
The Schwarzschild radius can be calculated using the equation for escape speed:
vesc = (2GM/R)1/2
For photons, or objects with no mass, we can substitute c (the speed of light) for Vesc and find the Schwarzschild radius, R, to be
R = 2GM/c2
If the Sun was replaced with a black hole that had the same mass as the Sun, the Schwarzschild radius would be 3 km (compared to the Sun's radius of nearly 700,000 km). Hence the Earth would have to get very close to get sucked into a black hole at the center of our Solar System.