Some of both really.
If I have a strong character concept then I choose the race to fit the concept, even at the cost of an "optimal" class/race combo. Sometimes, though, I'm playing a character to fill out the party, a healer say, and then I'll pick a race that works well with the class...