1. White Dwarf: This happens when a star with a mass less than about 8 times the mass of our Sun exhausts its nuclear fuel. It then sheds its outer layers, leaving behind a dense, hot core. This core, made mostly of carbon and oxygen, is known as a white dwarf. White dwarfs are incredibly dense, with a teaspoonful weighing tons. They slowly cool down over billions of years, eventually becoming black dwarfs.
2. Neutron Star: If the star's core is more massive (between 8 and 25 times the mass of our Sun), the gravitational pressure is so immense that electrons are forced into the protons, creating neutrons. This results in an incredibly dense object known as a neutron star. Neutron stars are only about 20 kilometers in diameter but can have a mass several times greater than the Sun. They also have extremely strong magnetic fields and can spin rapidly, emitting powerful radio waves that we detect as pulsars.
It's important to note that these are the most common outcomes. There are other possibilities depending on the star's initial mass and its composition, such as black holes which form from the collapse of stars with masses more than 25 times that of our Sun.