Given that my life has been an experience in Cross-Gender role playing I think I have a unusually broad view of the situation. In my (relatively short) time, I've come to see Gender not as a "One or the Other" situation, but much more as "Shades of Grey." People tend to lean more towards one than the other, but there aren't two distinct categories, and there's plenty of bleedover. I've met women best described as masculine, and men who everyone agreed were effeminate, and, though they didn't conform to their gender rolls, they were comfortable with themselves so I could only be happy for them. Male and Female are biological terms, Masculine and Feminine are psychological and sociological ideas, and though they're related, the two groups have less to do with eachother than most seem to think.
I think that most of Gender is learned, and thus part of the character's background. We learn what both genders are expected to be like when we're very young, and it's hard to break these mental molds and learn to see things differently. I also don't think most people often stop and think "what does it mean to be male?" or "what does it mean to be female?" except under exceptionally introspective circomstances (though some people seem to ask once and never stop thinking about it.) We start learning our Gender Rolls as soon as we're out of the womb (male and female infants are treated remarcably different), and society pushes us along it's path until we die. Straying from this path is both easy and hard, and can carry grave social consequences, though people do it all the time, and some groups are more tolerant than others.
As for the biological factor, having been on both sides of this equation, I must say that hormones do play a part in your mood, and shouldn't be discounted (though it is very easy to overplay, as these things are so commonly stereotyped.) The physical differences in males and females are suprisingly small, and, thankfully, DnD makes no moves to quantify them in the rules (a very safe decision.) This leaves it up to you to portray these differences... Or not to, if you don't care to. It is okay to play a character who comes off as androgenous; many people in real life do, and would only do so more the more difficult you made determining their sex by looking for visual or auditory cues (like a faceless character in a game.)
Most of what I'd give for advice on roleplaying a character of the opposite sex has already been given. It, like all the rest, is a list of what not to do, and I won't bother repeating what others have said. I will only add that, "Everyone is unique, and as long as you make your character a Real Person, their Sex and Gender don't matter at all."
Given my position, I like games that take Gender Rolls into account, and go into the consequences of breaking them, but these ideas aren't for everyone, and many people are made terribly uncomfortable by them. Just as I'm made uncomfortable with the idea of a group I couldn't play either male of female characters with. To each their own, and it's all about having fun. Remember it's just a game.
- Kemrain the Transgendered Person.
Oh, and I've taken that Gender test. It had no idea what I was. I found that extremely comforting for some reason- perhapse because I took it before I had an idea what I was.