As everyone knows, there are two genders: common and neuter.
Well, everyone in Stockholm knows that. So does everyone in Amsterdam. Go to Berlin or Moscow, though, and they'll tell you there are three genders: masculine, feminine, and neuter. So will people in many other countries. But speakers of Ojibwe and several other languages know that there are two genders: animate and inanimate. Meanwhile, in Luganda, there are ten genders: people, long objects, animals, miscellaneous objects, large objects and liquids, small objects, languages, pejoratives, infinitives, and mass nouns. But in Chinese, Finnish, and quite a lot of other languages, there are no genders at all.
Okay, yes, this is grammatical gender. And it may seem like language geekery, but languages are one way cultures express their views of the world, and one thing that about a quarter of all the languages in the world do is sort nouns into sets and change the forms of the words that relate to them — such as adjectives and articles — according to what set the noun belongs to. For instance, in French, "a green hat" is "un chapeau vert" but "a green shirt" is "une chemise verte": un and vert are for masculine nouns, and une and verte are for feminine ones. Apparently, hats are masculine and shirts are feminine. This is different from the English a versus an, which relies entirely on the next sound: We say "a red shirt" but "an orange shirt," so the noun shirt doesn't require a or an in the same way as the French chemise requires une.
As for Luganda: Does it really have ten genders? Well, it has ten noun classes, all but one of which also have a singular-plural distinction. Many other African languages also have complex systems of noun classes, with different prefixes for the different classes for nouns and the adjectives that modify them. Many Australian Aboriginal languages also have detailed classifications; Dyirbal is famous for having a noun class for "women, fire, and dangerous things" (which is the title of a book by the linguist George Lakoff) — actually, its four classes include one for women, water, fire, violence, and some animals; one for men and most animate objects; one for edible fruits and vegetables; and one for things that don't fit into any of the other three classes.
You may well be asking yourself: Is this all really gender? But grammatically, it functions the same way: The noun affects words that attach to it, modify it, or stand in for it according to what gender or class it belongs to. A similar kind of division, but one that functions quite differently grammatically, is the classification that languages such as Chinese have. A noun in Chinese doesn't have any effect on the form of the words that attach to it, but if you're going to count it, you have to use the right word. In Mandarin, for example, "one" is yi, dog is gǒu, and "cat" is máo, but "one dog" is yi tiáo gǒu and one cat is yi zhī máo (you count dogs with the same word — zhī — you use for legs, lives, and notes, while you count cats with the same word — tiáo — you use for pens, parrots, and sleeves).
English uses a few count words — "20 head of cattle" and "five sheets of paper," for example — but it doesn't have an obligatory system like Chinese. English also doesn't have grammatical gender any more. It used to — a thousand years ago, Old English had the same three genders as German and many other Indo-European languages: masculine, feminine, and neuter. We still have three gendered pronouns — he, she, and it — but now we use he and she for people and it for everything else. Well, almost everything. We may call our pets he and she, for instance. And we have a few other popular uses that seem to be holdovers. A ship is often called she. So, by some people, is a car. And if you spot a whale surfacing, you're supposed to say "There she blows!"
The problem is that the Old English word for "ship" (they spelled it scip) was neuter. The Old English word for "boat" (bat) was masculine. So was the word for "whale" (hwæl). And they didn't have a word for "car" (since people a thousand years ago didn't have cars). The use of the feminine pronoun in those instances isn't a holdover at all! It comes from more recent attitudes towards the things referred to.
Mind you, you can find a language in which a car is grammatically feminine. French, for one: la voiture. In German, on the other hand, as Volkswagen ads remind us, it's neuter: das Auto. Meanwhile, in Spanish it's masculine: el coche, el automóvil, or el carro.
Even in the same language, changing what you call a thing may change its gender, too: In Spanish, for instance, an office can be an officina, feminine, or a despacho, masculine. And in Italian, some things are masculine if you talk about one, but feminine if you talk about two or more — lips (labbro/labbra), fingers (dito/dita), arms (braccio/braccia), and eggs (uovo/uova), for example.
There just isn't an inevitable connection between the grammatical gender of nouns and their social-biological gender, even when we're talking about a person who is male or female by definition. The Old English word wif, which became modern "wife," was neuter, and wifmann — "woman" — was masculine. A German woman, eine Frau, is feminine, but a German girl, ein Fräulein or ein Mädchen, is neuter (because all words ending in –lein and –chen are neuter).
But this doesn't mean you always have to call a German girl the neuter pronoun es ("it"). You can still use sie ("she"). Likewise, in French, a person is always une personne, feminine, but that doesn't keep you from saying il ("he") in the next sentence if the the person is definitely a guy.
Which brings us to the other vexing grammatical detail relating to gender: pronouns. The connection between pronouns and grammatical gender is not always tight. English still has multiple pronouns even though it no longer has grammatical gender. Japanese doesn't have grammatical gender but it has different words for "he" and "she." Swedish, Dutch, and a few other languages have male and female pronouns although their masculine and feminine grammatical genders merged into a single "common" gender a long time ago. Meanwhile, in Ojibwe, which has an animate/inanimate gender distinction, the third-person pronouns don't distinguish gender but do distinguish whether the person is nearby or far away.
But many languages just don't have gender distinctions in their pronouns, including some that have some kind of grammatical gender — and, of course, many that don't, including Finnish, Turkish, Vietnamese, and a very large number of others. That doesn't mean that they don't have gendered roles or gender imbalances in their societies; it just means that they haven't coded it into their languages. They get by fine without specifying whether the person or thing referred to is masculine, feminine, neuter, animate, inanimate, fire, long, small, or whatever.
And then when they're translated into a language that does have gendered pronouns, the translator has to decide which pronoun to use — which can sometimes reveal cultural assumptions too: As Emre Şarbak has pointed out, Google Translate will render Turkish o as he if referring to a single, happy, or hard-working person, for instance, but as she if referring to a married, unhappy, or lazy person.
And sometimes pronouns change for one reason or another. In Old English, for example, "she" was heo; it changed during Middle English (around 700 years ago) because the forms were getting simplified and people were having trouble with the difference between the masculine and feminine pronouns. In Swedish, a new pronoun, hen, is gaining ground as a way to avoid specifying male (han) or female (hon). And in Mandarin Chinese, while a single pronoun, tā, is still used for "he," "she," and "it," the written character for "she" changed in the early-mid 1900s as a result of interaction with the West and cultural changes. So when you speak Chinese you don't specify "he" versus "she," but, since about 80 years ago, when you write it you do. But that's still not grammatical gender — it's just a semantic distinction.