A neutron star is the collapsed core of a star (usually weighing between 10-29 solar masses). They have a mass of 1.4 times our sun and neutron stars are the most dense stars in the universe. (They are also the smallest stars known to exist.) A neutron star is so dense that a teaspoon of a star would come out to be a billion tons.
It is very rare that two neutrons stars will collide. When they do, however, their neutron star remnants spiral inwards and merge. This takes place with two massive stars that have both died in supernova explosions.
These neutron star remnants merge to form a black hole. 96% of the mass forms to make a black hole while a fraction of the mass gets ejected.
This event leads to a gamma ray burst. The parts of the neutron star that get ejected typically form some of the heaviest elements on the periodic table including gold.
This is the primary source of elements such as gold, platinum, and tungsten.