The black goat receives a letter from the white goat but she eats up the correspondence upon arrival. So she writes back: さっきの手紙のご用事なあに？(Sakki no tegami no go-yōji nāni? “What were the contents of your letter?”). Since the white goat is prone to the same eat-before-reading habit, the story in this Japanese children’s song やぎさんゆうびん (yagi-san yūbin, “Goat Mail”) goes on and on endlessly, with one of the two protagonists wondering anew each time about the 何 (nani, what) of that unread letter.
And even if you’re no goat, nor any other kind of letter-muncher for that matter, there are, in fact, quite a few things to wonder about with 何.
To start with, the kanji has two slightly different readings, and these seem to make it mean substantially different things. The first one is nani (in the goat song, the “a” sound is stretched in the way children would say it), and it translates very straightforwardly as “what.” You’ll find it in inquiries such as 何がいい？ (Nani ga ii? “What would you like?”), 何がいけない？ (Nani ga ikenai? “What don’t you like about it?”), or just plain 何？ (Nani? “What?”), which depending on intonation can be everything from a careful request for clarification to a strong expression of disbelief or contempt. Just like in English, basically.
何 also appears as the first element in a number of compounds. In these cases, nani is used to ask for specifics about the “what” of the thing it’s attached to, as in 何語 (nani-go, what language) or 何型 (nani-gata¸ what type, often used to ask blood type in particular). If you are wondering about the name of a person, you can say 何 さんでしたっけ？(Nani-san deshitakke? “What’s her name again?”). And if you want to stir up some controversy among locals of the Chubu region, you can easily do so by asking 富士山は何県にありますか？ (Fuji-san wa nani-ken ni arimasu ka? “What prefecture is Mount Fuji in?”), because both Yamanashi and Shizuoka claim the mountain to be theirs.
Now for the second meaning, where it may get a little confusing. 何 is also used to inquire about quantities, in the sense of “How many?” In this case it is read nan, not nani, and occurs in compounds such as 何歳 (nan-sai, how old), 何円 (nan-en, how much yen), or, as often heard around this time of year, 今日は何度ですか？ (Kyō wa nan-do desu ka? “How many degrees is it today?”).
The difference between the two types of 何 becomes most obvious in compounds that can go both ways depending on how you read them. An example is 何人, which can be both nani-jin and nan-nin. The former can be an inquiry about a person’s nationality, whereas the latter asks about the mere number of people, no matter where they are from. Similarly, 何色 reads both nani-iro (what color) and nan-shoku (how many colors). The aforementioned 何語, if read nan-go, can mean how many words, and 何県, depending on context, could just as well be nan-ken (how many prefectures).
The nani/nan pattern looks fairly systematic, but unfortunately that’s only because the examples given so far have been somewhat handpicked. The main problem is with the “what” meaning. On closer inspection there are many cases where it’s not read nani, as the rules would predict, but nan.
To see this, let’s just assume that the two goats from the song were writing to each other in the formal style. In such a case, it would be さっきの手紙のご用事は何ですか？ (Sakki no tegami no go-yōji wa nan desu ka?), where nani has become clipped into nan.
Or take time expressions. True, for 何秒 (nan-byō, how many seconds) and 何分 (nan-pun, how many minutes) the pattern applies. However, there is also 何時 (nan-ji, what time) and 何月 (nan-gatsu, what month), which despite their nan reading clearly ask about “what.” If the question was “how many,” it would have to be 何時間 (nan-jikan, how many hours) and 何カ月 (nan-kagetsu, how many months). The whole shallowness of the nani/nan pattern is most painfully apparent in 何年, which is indiscriminately read nan-nen, whether it’s supposed to mean “what year” or “how many years.” Don’t watch out for nani-nen, because there is no such reading.
One thing that’s extremely convenient about 何 is its capacity to serve as a dummy in approximate counts, whenever a more precise quantification is not possible or just not considered worth the trouble. Here is how it works: Take 何, read nan, and prefix it to the thing whose quantity you are unsure of (or don’t care about). Add か or, for more emphasis, も, and you’ll get something like, say, 何キロか太った (nankiro ka futotta, “I’ve gained a few kilos”) or 何時間も待たされた (Nan-jikan mo matasareta, “They made me wait for hours”).
For larger quantities — hopefully not time spent waiting or pounds gained — 何 also combines with numbers. It can replace any digit, depending on the roughness of the estimate. For instance, if you were to calculate the time our two goats have been writing each other these unread letters, a likely estimate could be 十何時間も (jū-nan-jikan mo, 10 + x hours) or, even worse, 何十時間も (nan-jū-jikan mo, x times 10 hours). And they still wouldn’t know what’s what.