1. Which party will they hold?

2. They will hold a party for their teacher's birthday.
[#2 is the answer to #1. 'For their teacher's birthday' is an adjective phrase, which modifies 'party.']

3. Why will they hold a party?
4. They will hold a party for their teacher's birthday.
[#4 is the answer to #3. 'For their teacher's birthday' is an adverb phrase, which modifies 'hold.' Is my explanation right? Then, #2 or #4 has ambiguity. Is that right?]

"for their teacher's birthday" modifies "party", a noun, telling what they will hold. It's an adjective phrase.

#1 also makes no sense. Which party? The one yesterday or the one tomorrow or the one today? The one at your house or the one at the local nightclub or the one in the street? Which one? The question should be WHY will they hold a party, as in #3.

Thank you, Reed. Then, 'for their teacher's birthday' should be an adverb phrase, which modifies 'held'? Is that right? [In #4]

You did not read what I wrote. "for their teacher's birthday" tells what kind of party they will hold. Party is a noun. It's an adjective phrase. It does not modify "hold". They will hold for their teacher's birthday? What will they hold? Her hand, a balloon, their breath? They will hold A PARTY! The prepositional phrase tells why they will have or hold A PARTY. Why a party? Is it for his birthday, a going-away party, for his anniversary, because he's a nice guy or a good teacher? It's "for his birthday." It modifies PARTY.

Your explanation is correct!

Regarding your question about ambiguity between sentences #2 and #4, there is no ambiguity in this case. Both sentences convey the same meaning, that is, the reason behind holding the party is their teacher's birthday. In sentence #2, "for their teacher's birthday" is used as an adjective phrase, which tells us more about the party itself. In sentence #4, "for their teacher's birthday" is used as an adverb phrase, modifying the verb "hold" and indicating the purpose or reason for holding the party.

So, you can choose either sentence #2 or sentence #4 to answer the question about why they are holding a party for their teacher's birthday. Both sentences convey the same information, just in slightly different grammatical structures.