Are all black holes formed after the death of a massive star? If not, how are these non stellar black holes formed?
Black holes fall broadly into two categories. Firstly there are galactic, stellar mass black holes, which as the name suggests are found throughout galaxies and have masses similar to that of stars (of order 10 times the mass of the Sun). These form at the end of the lives of stars that are too massive to become white dwarfs or neutron stars. This occurs when they are still greater than two or three times the mass of the Sun by the time they have shed material through stellar winds or supernova explosions during their death. The gravitational force causing them to collapse is too strong for the pressure of electrons or neutrons to support the star as in the case of white dwarfs and neutron stars, so it keeps collapsing down to a black hole.
Secondly, there are so-called supermassive black holes, which tend to be around 100 million times as massive as the Sun. These are believed to be found at the centre of most galaxies about which the stars in that galaxy orbit (in fact our own galaxy, the Milky Way, has a black hole 4 million times the mass of the Sun at its centre). While the exact mechanism of their formation is still unknown, it is believed they form when a large gas cloud collapses to the centre of the large gravitational 'well' in the centre of a galaxy as it forms.
In addition there may be 'intermediate mass black holes' which could explain a number of observed phenomena such as 'ultraluminous X-ray sources.' When matter falls into a black hole, it emits radiation, part of which is seen as X-rays. These appear much brighter than stellar mass black holes, implying their mass is around 1000 times that of the Sun, but they are not at the centre of galaxies. Their formation is a mystery. They are too massive to form from a single star, but they could be formed when multiple stars or stellar mass black holes are pulled together by gravity and merge. Alternatively, they could be the central black hole from a smaller galaxy that has merged with the galaxy in which they are found and in the process, were thrown out from the centre.