What determines whether a star will evolve into a white dwarf, a black hole or a neutron star?