Elements heavier than helium are produced in the lives and deaths of stars. This Review discusses when and how the process of nucleosynthesis made elements. High-mass stars fuse elements much faster, fuse heavier nuclei, and die more catastrophically than low-mass stars. The explosions of high-mass stars as supernovae release elements into their surroundings. Supernovae can leave behind neutron stars, which may later merge to produce additional heavy elements. Dying low-mass stars throw off their enriched outer layers, leaving behind white dwarfs. These white dwarfs may also later merge and synthesize elements as well. Because these processes occur on different time scales and produce a different pattern of elements, the composition of the Universe changes over time as stars populate the periodic table.