When stars end their lives either quietly or explosively, they recycle some of their material back into interstellar space. Some of this contains heavy elements formed during the star's life (or death) and provide the building blocks for future planets.