When a star burns through most of its nuclear material, it can explode in a bright supernove and leave behind a dense core. If that core is massive enough, it'll become a neutron star.
See All 1944 Episodes of "A Moment of Science"