During the war of 1812 (on September 14, 1814), poet Francis Scott Key wrote a poem entitled “Defense of Fort McHenry”, being inspired by seeing the American flag still flying amidst the battle. Key never meant for it to become a song, or a national anthem, yet after showing the poem to his brother in law Judge Joseph H Nicholson, Nicholson noticed the poem could fit the tune “The Anacreontic Song” (also known as “To Anacraeon in Heaven”), a song originally written for a gentlemen’s social club in London, but gained popularity outside Great Britian, including in the United States, where by this time the tune was familiar to American ears. (The tune was also once the national anthem of Luxembourg). Key may have had this tune in mind when he wrote the poem; an earlier poem of his called “When the Warrior Returns” was also in the same rhythym, could be set to the same tune, and is of similar subject matter – the last two lines of each stanza of that poem also end with “wave” and “brave”.
The poem spread quickly across the United States, the first printing of the poem in a Baltimore paper suggested the “Anacraeon in Heaven” tune, and it stuck. A Baltimore music store owner first printed the song under the title “The Star Spangled Banner.” It gained in popularity, and was made the official tune to accompany flag raisings by the secretary of the Navy in 1889. In 1916 it was ordered to be played at military and other occassions, and, due to a large public relations effort, it was officially adopted by Congress as the first official national anthem of the United States in 1931. There are four verses to the anthem, but it is the first verse that is almost always sung. (Interestingly, the first verse is a question, only answered by the other three verses).
In addition to countless patriotic songs, there are also state songs for each of the fifty states as well. Also, the song “Lift Ev’ry Voice and Sing” is considered an unofficial anthem by the African-American community, and is often used by African-American organizations and at events for the African-American community.