Neutron stars are formed from the remnants of massive stars that have exploded in a supernova. When a star exhausts its nuclear fuel, it can no longer support itself against gravitational collapse. If the remaining core after the supernova is between 1.4 and 3 solar masses, it will collapse into a neutron star. If it's more massive, it will likely become a black hole.