We just prayed for a long time. How can the prayer now say "we do not know what to do"?
It does sound odd. By this point you have sat through the psalms of praise, stood for the Amidah (the main prayer), and put your head on your arm for Nefilat Apayim. Then you say: we do not know what to do.
The answer starts with Moshe. When he went up the mountain, the Torah describes three postures: "I sat on the mountain," "I stood on the mountain," and "I fell down before Hashem." The Mishnah Berurah (a central commentary on daily Jewish law, written around 1900) says that is the reason for this line. We have prayed in every way a person can, sitting, standing, and falling on our faces, as Moshe did. So we say: we do not know what to do.
Abudarham matches each posture to the service. We sat for the psalms at the start, stood for the Amidah, and fell on our faces after it. From then on, he writes, we do not know how to pray in any other way.
One detail: in the Torah those three verses come in a different order. Moshe sits (Devarim 9:9), falls (9:18), and stands (10:10). Abudarham lists them as sitting, then standing, then falling, to match the order of the service. The Mishnah Berurah lists the three without saying which came first.
Sefer HaMachkim ends the thought differently: we prayed sitting, standing, and falling, "but in this we trusted: our eyes are on You." Read this way, the line is not "we are lost." It is "we have used every way we know, and now we look to You."
The custom follows the words. The Mishnah Berurah, quoting the Shelah (Rabbi Yeshayahu Horowitz, who died in 1630) and later authorities, says it is fitting to say "we do not know" sitting and "what shall we do" standing. The Kitzur Shulchan Aruch (a short guide to daily Jewish law from the 1860s) says the same. If you see people stand up in the middle of the sentence, that is why.
Mishnah Berurah 131:9,Abudarham, Weekday Prayers, Post Amidah,Devarim 9:9, 9:18 and 10:10,Sefer HaMachkim 85,Kitzur Shulchan Aruch 22:3Isn't saying "we have no idea what to do" just giving up?
The sentence is older than the prayer book, and it was said in a real emergency. In Divrei HaYamim II (Chronicles) chapter 20, King Yehoshafat of Judah is told that a huge army is coming against him. The text says he was afraid. He called a fast, and people came from all over Judah, children included.
He stood in the Temple in front of them and prayed. He began with God's power, then described the situation: we have no strength against this crowd, and we do not know what to do, but our eyes are on You. The Malbim (a 19th-century commentator) points out how complete the admission is. The king is telling God not to think that Judah will come up with its own plan and its own strength. They have neither.
Then a Levite named Yachaziel spoke up from the crowd, as the spirit of God came on him: "The battle is not yours but God's." He told them they would not have to fight it. But he did not tell them to stay home. He said: "Tomorrow, go out to meet them."
Early the next morning they went out. Yehoshafat told the people, "Trust in Hashem your God and you will stand firm." He put singers at the front of the army, singing "Thank Hashem, for His kindness is forever." When the singing began, the enemy armies turned on each other. When Judah reached the lookout, no one was left. On the fourth day they gathered in a valley to bless God, and it was named the Valley of Blessing.
So this line comes from a prayer that said "we have no plan" and then walked out the door the next morning. The siddur borrows only the sentence, not the ending.
Divrei HaYamim II 20:1-26,Malbim on Divrei HaYamim II 20:12"Even in anger, remember mercy." Is God angry at me?
These words were not first said about you. They are from the prophet Chavakuk (Habakkuk). Chapter 3 of his book is "a prayer of Chavakuk the prophet." Radak says he had heard a prophecy of a long exile and was afraid, so he asks God to keep the people alive through those years and, in anger, to remember mercy.
Who is angry at whom? Even the classic commentators read it two ways. Rashi (the main medieval commentator on the Torah, who lived in France about 900 years ago) says "in anger" means God's anger at the wicked, and the prayer asks God to remember to have mercy on Israel. Radak says the time of anger is the exile itself, and asks God to remember the love of Israel's ancestors. Neither one stops to ask what anger means when it is said about God.
The Ribono Shel Olam prayer, earlier in the morning, asks that question and gives the Rambam's answer.
Chavakuk 3:1-2,Radak on Chavakuk 3:2,Rashi on Chavakuk 3:2