At the end of their life hot and blue stars explode like cosmic fireworks, called supernovae or supernovas. When the fire which keeps the star looking like a ball burns through its fuel, the force of gravity pulls all the star in towards the centre. This happens so fast, that it has a drastic effect on the star. The very centre is crushed into a neutron star or a black hole. When this happens, the rest of the star bounces off the core, in a hot, bright explosion.
As time goes on, the insides of the star, which was made of hot gas, spreads into space like a ball-shaped cloud. This is the supernova remnant.