Besides the comparatively calm end of low-mass stars, e.g. as white dwarf with a surrounding planetary nebula, there are some stars which end their lives in a gigantic explosion. Thereby the original star is completely destroyed or collapses to a neutron star or black hole. During the explosion, the star can shine as brightly as an entire galaxy of hundreds of millions of stars.
Supernova explosions can be caused by white dwarf stars: Here the white dwarf collects matter from a close companion star, exceeds a critical mass limit and explodes by a fast onset of carbon fusion inside.
On the other hand, supernova explosions occur when a very massive star at its end of life can no longer maintain the balance between radiation pressure and gravity. If the fuel inside runs out, gravity wins and the stellar core collapses. During the process, pressure waves are generated that lead to the blasting off of the outer stellar layers.
The blasted hot gases strike the interstellar medium, form shock waves, and cool down. During this phase, they emit energy in the visible region of the spectrum, which we can capture in our images.