There are lots of possible ways that stars can end their life, even in the subset of cases where the end is violent. Eloff has given an excellent answer, but I wanted to add a few points.
You need the right conditions (mass, angular momentum, metallicity, etc) to produce a proto-neutron-star which is able to resist complete collapse to a black-hole. The bounce from hitting that proto-neutron-star surface, and the heating from neutrinos, is what drives the explosion of material. Radioactivity is eventually the source of the light we see from supernovae.
The basic picture for producing a supernova from a massive star1:
The star burns progressively heavier elements on shorter timescales until producing iron (Fe) on the timescale of seconds.
After iron, fusion in the core ceases, and pressure support is lost. Gravity is unhindered, and the star begins dynamical collapse.
As the Fe-core contracts, electron-capture begins to convert protons + electrons into neutrons, emitting MeV neutrinos.
The Fe-core, now largely composed of neutrons is stabilized to further collapse by neutron degeneracy pressure at nuclear densities.
Material further out, which is still collapsing, hits the incredibly hard proto-neutron-star surface - causing a bounce (see video analog): the launch of a powerful shockwave outwards through the star.
Because the neutrinos produced from electron-capture are so energetic (as dmckee points out), and because the densities are so high - the neutrinos are able to deposit significant amounts of energy into the outer-material, accelerating it beyond escape velocities. This is the supernova explosion.
Due to the hot, dense, nucleon-rich nature of the ejecta, r(apid)-process nucleosynthesis produces radioactive Nickel (Ni) and Cobalt (Co).
After roughly 10's of days, the expanding supernova ejecta becomes optically thin - allowing the radiation produced by Ni and Co decay to escape - this causes the optical emission we call a supernovae.
Why does a supernova explode?
All massive stars are not believed to produce supernovae when they explode. In the following figure (which is intended to convey the basic idea - but not necessarily the quantitative aspects), regions titled 'direct black-hole formation' are regions of initial mass where the neutron-degeneracy pressure (stage '4' above) is insufficient to halt collapse. The Fe core is massive enough that it continues collapsing until a black-hole is formed, and most of the material further out is rapidly accreted.
The region in this plot between about 8 and 35 solar masses is where the vast majority of observed supernovae are believed to come from.
To answer why supernovae explode: Consider the schematic process outlined above. The reason why some deaths-of-massive-stars explode and others don't, is that you need the right conditions (mass, angular momentum, metallicity, etc) to produce a proto-neutron-star which is able to resist complete collapse. The bounce from hitting that proto-neutron-star surface, and the heating from neutrinos is what drives the explosion of material. Radioactivity is eventually the source of the light we see from supernovae.
1: This discussion is constrained to 'core collapse' supernovae - the collapse of massive stars, observed as type Ib, Ic, and type II supernovae
Basically any paper by or with Stan Woosley, e.g.