When neutron stars merge, they create a powerful explosion called a kilonova that flings out neutron-rich material, some of which decays into heavy elements through a process called the r-process.