Neutron star formation occurs when a massive star exhausts its nuclear fuel and undergoes a supernova explosion, collapsing under gravity to form a dense core composed almost entirely of neutrons. These remnants are incredibly dense, with a mass greater than that of the Sun but compressed into a sphere only about 20 kilometers in diameter, exhibiting extreme gravitational and magnetic fields.