The mass of a star is the single characteristic that determines that heavenly body's fate. Its end-of-life behavior depends entirely upon its mass. For lightweight stars, death comes quietly, a red giant shedding its skin to leave the dimming white dwarf behind. But the finale for a heavier star can be quite explosive!
Medium stars are those that, too big to end as white dwarfs and too small to become black holes, spend their dying years as neutron stars. Scientists have observed this category to have a lower limit of just above 1.4 solar masses and an upper limit in the neighborhood of 3.2 solar masses. (A "solar mass" is a unit of measurement roughly the same mass as our Sun.)
The size of a star is determined by how much matter is available in its parent nebula. This cloud of dust and gas begins to collapse upon itself due to gravity, forming an increasingly hot, bright, dense mass at its center: a protostar.
When the protostar is sufficiently hot and dense, the process of hydrogen fusion begins taking place in its core. Fusion produces enough radiation pressure to counteract the force of gravity; thus gravitational collapse ceases. The protostar has become an actual star in its main sequence phase. The star will spend the bulk of its life span in this period of stability, generating light and heat via the fusion of hydrogen into helium for millions of years.
When the star's core runs out of hydrogen, gravity has its way once more--that is, until temperatures rise high enough to allow helium fusion, which produces the outward pressure needed to stabilize things. When no helium is left, the cycle begins again. The core thus oscillates between states of compression and equilibrium as increasingly high-temperature fusion reactions take place. Meanwhile, the extreme heat causes the star's outer layer, or "shell," to expand to a radius comparable to that of the Earth's orbit. At such a great distance from the core, the shell will cool down enough to turn red. The star is now a red giant.
Nuclear reactions cease forever when the star's core is reduced to iron; that element will not fuse without additional energy supplies. Gravitational collapse resumes catastrophically with a force strong enough to destroy the very nuclei of the atoms that make up the core. This generates so much energy that the explosion dominates the sky for light years in every direction. The star has gone supernova.
Meanwhile, what's left of the star has shrunk to a diameter no larger than a few kilometers--about the size of a city. At this density, the outward pressure generated by protons and neutrons reacting to compression is finally sufficient to halt gravity. The star is so dense that, if you could bring a teaspoon of its material to Earth, it would weigh a trillion tons. It rotates up to 30 times per second and exhibits a very large magnetic field. It is a neutron star, the final stage of a medium-sized star's life cycle.