Universe Today explains that black holes are the result of objects collapsing under the force of gravity until the acceleration needed to escape from them exceeds the speed of light. Any object can, in principle, become a black hole if it collapses to sufficient density. They can also be formed from two neutron stars colliding together. According to Universe Today, there are supermassive black holes in every galaxy.
During a star's active life, the crushing force of gravity is counterbalanced by the energy that the star produces by nuclear fusion. This energy keeps the star inflated against the gravitational pressure to collapse. After the star's fuel is exhausted, it begins to collapse. For stars as massive as the Sun, resistance to gravity is ultimately provided by the mutual repulsion of the electrons in its atoms. Larger stars that have a stronger gravitational force overcome this force and collapse until the only thing holding them up is the exclusion principle that prevents neutrons occupying the same state. For stars over three times the mass of the Sun, however, not even the exclusion principle is strong enough to stop the collapse.
Consistent with the Chandrasekhar Limit, stars this massive ultimately overcome the resistance of their neutrons, and they collapse into black holes. As the body collapses, its density increases until the only way to escape its gravity is to travel faster than light. As no massive object can ever travel this fast, an event horizon forms around the black hole and nothing ever leaves it again.