There are a few things I consider when picking gender in a game.
Is the character voice acted? Which voice actor do I think performs better?
is the game third person? Which gender has the better look in armor/clothing in the game?
Does the game feature romance? If so, then I almost always pick my own gender for a first playthrough at least.
Which gender do I think the plot of the game will be more compelling for?
In tabletop D&D, gender tends to be the last thing I choose in a character (as opposed to video games that usually want it to be your first choice), and I basically just look at the made character including personality and backstory and realize that it's more interesting or fun to play as one gender or the other.
I pretty much agree with everything here except D&D. I just don't have enough confidence in my voice to play a female character exclusively. I already have some difficulty doing it well enough for DMing, but this is something I hope to change. Maybe that's because I've never played with a premade though.
I don't generally force a pitch for different genders if that's what you're talking about. If I'm doing a voice, it'll be in the accent and/or volume more and maybe the mannerisms.