There are different types of supernovae. Type Ia are thermonuclear explosions. The most well known are core-collapse supernovae. These take place when a star at least 8 times the mass of the Sun, runs out of fuel.
When a massive star reaches the final stages of its evolution, its core is made mostly of iron. The star cannot fuse elements heavier than iron. This means fusion stops. At this point, there is no outward pressure to balance the inward pull of its gravity. Gravity pulls all the material in the star towards its middle. This starts a sudden, rapid collapse of the star.
The outer layers of the star collapse inwards until they reach the core. They bounce of the surface of the dense iron core at around 30,000 kilometres per second. This sends shock waves through the star. The shock waves cause the star to explode as a supernova.
Huge amounts of energy are created during the collapse and new elements form in the process. The star brightens quickly, then gradually fades away leaving only core. During the explosion the core collapses down to create either a neutron star or a black hole.
The material which was thrown out during the explosion surrounds the core. We call this a supernova remnant. It will eventually drift into space and become part of a huge cloud of dust and gas. New stars will form in this cloud. This is how elements made in the first stars were recycled to make everything in our Solar System, including us!