With D&D 5e, it’s a combination of what subclass sounds cool, has fun abilities I’d like to try, and “I’ve got a character in mind that fits this.”
With classless systems, it’s much more about a character archetype or personality that I want to play out - this is often where I lean on tropes...