These massive stars end their lives in a cataclysmic explosion known as a supernova. During a supernova, the star's core collapses under its own gravity, releasing a tremendous amount of energy. This energy causes the outer layers of the star to be expelled into space, forming a supernova remnant.
If the core of the massive star is more than three times the mass of the Sun, it will collapse to form a black hole. A black hole is a region of spacetime with such intense gravitational force that nothing, not even light, can escape from it. The boundary of a black hole is called the event horizon. Anything that crosses the event horizon, including light, is trapped within the black hole and cannot escape.