How do black holes form from dying stars?
When a massive star (typically more than 20 times the mass of our Sun) exhausts its nuclear fuel, it can no longer support itself against gravity. The core collapses catastrophically in a fraction of a second, while the outer layers explode outward as a supernova. If the remaining core mass exceeds about 3 solar masses, no known force can halt the collapse, and it continues until the matter is compressed into a singularity with infinite density, surrounded by an event horizon from which nothing, including light, can escape.
Smaller stars don't form black holes this way. Stars like our Sun end as white dwarfs, while intermediate-mass stars may become neutron stars. Only the most massive stellar cores achieve the conditions necessary for black hole formation.