A final gesture or performance, given before dying or retirement.
This term derived from the legend that, while they are mute during the rest of their lives, swans sing beautifully and mournfully just before they die. This isn't actually the case - swans, even the inaccurately named Mute Swans, have a variety of vocal sounds and they don't sing before they die. The legend was known to be false as early as the days of ancient Rome, when Pliny the Elder refuted it in Natural History, AD 77:
"Observation shows that the story that the dying swan sings is false."
Nevertheless, poetic imagery proved to be more attractive than scientific method and many poets and playwrights made use of the fable long after Pliny's observations. Chaucer included this line in the poem Parliament of Fowles:
The Ialous swan, ayens his deth that singeth. [The jealous swan, sings before his death]
Shakespeare, the Swan of Avon no less, used the image in The Merchant of Venice, 1596:
Portia: Let music sound while he doth make his choice; then, if he lose, he makes a swan-like end, fading in music.
The actual term 'swan song', with its current figurative meaning, doesn't crop up in print until the 18th century. The Scottish cleric Jon Willison used the expression in one of his Scripture Songs, 1767, where he refers to "King David's swan-song".
The poet Samuel Taylor Coleridge (1772-1834) turned the phrase on its head in the poem On a Volunteer Singer:
Swans sing before they die; ’twere no bad thing
Did certain persons die before they sing.
If people ever did believe in the 'singing before death' story, few would now claim to do so. 'Swan-song' is now used figuratively and most commonly to refer to celebrated performers embarking on 'farewell tours' or 'final performances'. Those ironic quote marks were never more appropriate than in the case of Nellie Melba, whose swan song consisted of an eight year long string of 'final concerts' between 1920 and 1928. This led to the popular Australian phrase - 'more farewells than Nellie Melba'.