A medium-mass star, typically between about 4 to 8 times the mass of the Sun, ends its life in a dramatic way. After exhausting its nuclear fuel, such a star expands into a red giant and undergoes complex fusion processes, including helium burning and fusion of heavier elements like carbon and oxygen in shells around the core. Eventually, the core collapses when iron builds up and fusion can no longer proceed. This collapse triggers a massive explosion called a supernova. The remnant core left behind is extremely dense and forms a neutron star, which is only about 10–20 km in diameter. Neutron stars are incredibly dense objects where gravity forces protons and electrons to combine into neutrons. They can rotate rapidly and have strong magnetic fields
. In summary, a medium-mass star ends its life by exploding as a supernova and leaving behind a neutron star.