why do some stars end up as black holes

The actual answer has nothing at all to do with the temperature. Even low-mass stars would form black holes if they ran out of nuclear fuel to burn, and simply cooled whilst being supported by "standard" gas pressure in their centres. That is because that gas pressure would be proportional to the temperature, but the star is able to cool so it would need to shrink and use gravitational energy to stay hot, but of course eventually it would disappear inside its event horizon and become a black hole. The real reason this does not occur is electron degeneracy pressure.


This is a quantum mechanical effect, related to the Pauli exclusion principle, that does not allow two electrons to occupy the same quantum state. As the gas gets squashed in the core, the electrons are forced to fill higher and higher momentum states in order to "avoid" each other. Because these electrons have large momentum they also exert a large pressure - degeneracy pressure. This degeneracy pressure
does not depend on temperature and so the star (it is a white dwarf when a low-mass star arrives at this stage) can cool and remain in hydrostatic equilibrium without shrinking any further.


Thus it avoids becoming a black hole (or even a neutron star) and simply cools at nearly constant radius. A common type of black hole is produced by certain dying stars. A star with a mass greater than about 20 times the mass of our Sun may produce a black hole at the end of its life. In the normal life of a star there is a constant tug of war between gravity pulling in and pressure pushing out. Nuclear reactions in the core of the star produce enough energy and pressure to push outward.


For most of a star s life, gravity and pressure balance each other exactly, and so the star is stable. However, when a star runs out of nuclear fuel, gravity gets the upper hand and the material in the core is compressed even further. The more massive the core of the star, the greater the force of gravity that compresses the material, collapsing it under its own weight. For small stars, when the nuclear fuel is exhausted and there are no more nuclear reactions to fight gravity, the repulsive forces among electrons within the star eventually create enough pressure to halt further gravitational collapse.


The star then cools and dies peacefully. This type of star is called a white dwarf. When a very massive star exhausts its nuclear fuel it explodes as a supernova. The outer parts of the star are expelled violently into space, while the core completely collapses under its own weight. If the core remaining after the supernova is very massive (more than 2. 5 times the mass of the Sun), no known repulsive force inside a star can push back hard enough to prevent gravity from completely collapsing the core into a black hole.


From the perspective of the collapsing star, the core compacts into a mathematical point with virtually zero volume, where it is said to have infinite density. This is called a singularity. Where this happens, it would require a velocity greater than the speed of light to escape the object's gravity. Since no object can reach a speed faster than light, no matter or radiation can escape. Anything, including light, that passes within the boundary of the black hole -- called the event horizon -- is trapped forever.