The end of a starâs life depends on its mass. Low to intermediate-mass stars, like the Sun, will shed their outer layers to form a planetary nebula and leave behind a white dwarf. More massive stars undergo supernova explosions and can leave behind either a neutron star or a black hole, depending on the remaining core mass.