The short answer: because Francis Scott Key wrote it that way.
But we can do better than that. Let's have a look:
O! say does that star-spangled banner yet wave,
o'er the land of the free and the home of the brave?
If, like most Americans, you've spent more time singing the Star-Spangled Banner than reading it, the question mark that appears at the end of the first stanza might look a little funny. When we sing the anthem, we don't end it questioningly, but with a firm, declarative (sometimes over-warbled) note.
It's easy to forget that the words to the national anthem describe a real battle during the War of 1812. The rockets' red glare and the bombs bursting in air aren't just poetic flourishes—they were actual bombs and rockets being fired upon Baltimore's Fort McHenry on the night of September 13, 1814, as the fate of a young nation hung in the balance. Francis Scott Key had secured the release of an American prisoner of war, but was held behind the British fleet arrayed in Baltimore harbor until after the attack on the Fort. He was powerless to do anything but watch as the British bombarded the American forces. The first stanza of the Star-Spangled Banner captures the mix of fear, patriotism, and anxiety that Key felt throughout the long rainy night of the battle. Does that Star-Spangled Banner yet wave? Would he have a country to return home to?
We sing only the first stanza of Key's song, but the Star-Spangled Banner actually has four verses. Only the first stanza ends with a question mark. You can read the other four stanzas, which include plenty of exclamation marks but no question marks.
Today some people choose to interpret Key's words—and the question mark—more broadly, not just as a question of whether the flag is still flying, but as a moment to reflect on whether we are upholding the ideals embodied in the vision of America as the land of the free and the home of the brave.
So yes, there is a question mark at the end, but we give you permission not to sing it that way.
Megan Smith is an Education Specialist at the National Museum of American History. She has also blogged about why visitors can't photograph the Star-Spangled Banner on display in the museum. For more information on the Star-Spangled Banner (flag and anthem), check out the exhibition website or explore nearby sites on the the National Park Service's Star-Spangled Banner National Historic Trail.