Much has already been written about Tolkien's treatment of death. I think we're so acclimated to the 'death-as-gift' mechanic of his world that we've forgotten just how jarring that notion is - at least, I have. We've seen how death and the short lifespan of humans in Tolkien's world becomes the impetus for change and history. It also becomes an impetus for art.
Not -the- impetus for art. The Elves' songs of praise are among the first sub-creative pieces that appear in Arda. But aside from the simple desire for power that is characteristic of Morgoth and Sauron, one of the strongest driving forces behind the major characters seems to be grief. Loss is central to the motivations of many of the First Age's greatest. Feanor and the Exiles, Turin, Beren and Luthien; each are characterized by a single moment that fills them with lifelong grief. Fast forward to the fall of Numenor, for which sad songs are spun for thousands of years afterward. And nobody escapes the War of the Ring without cause for sorrow. But death in Tolkien's world is not quite the same as death in ours. Is there then a difference in how they mourn?
I don't believe so, though in these stories, the mourning ends up having a larger purpose. In The Lord of the Rings, Tolkien eulogizes the major characters he kills off in the words of other characters who bore witness to it. Aragorn and Legolas end off Boromir's funeral with an impromptu song in his honor. Why do they do this? The text of the eulogy itself addresses the winds, asking for tidings of Boromir, and revealing each wind's answer. It seems to be a commentary on a subject of great interest to Tolkien - the transition from history to storytelling to myth. We are explicitly presented with the moment where Boromir's life goes from empirical reality to a poetic story. Gimli does not sing a verse for the East wind, for doing so would allow the influence of Sauron to corrupt the memory of Boromir, and risk turning his life-story towards his own purposes. As concerned as Tolkien was with the dangers of myth in our world, he imbued his characters with the same concern.
The account of Theoden's eulogy displays the continuation of this process. To my untrained eye, it looks a good deal like the introduction to Beowulf, or more generally, an Anglo-Saxon poem. But the tone of the song is historical; the listener is not driven to mourn Theoden personally, but to understand how deeply Theoden was mourned. It is a song that does not stand by itself, but is given meaning if the listener is already instructed about Theoden's life. It is not a eulogy - it is a part of a story.
I don't think it's too much of a stretch to justify this interpretation via Lewis's toolshed metaphor. Imagine a Middle-Earth historian, seeking to understand Theoden the historical figure. They may be tempted to focus on primary documents - edicts that he signed, direct verifiable quotations, letters - but the eulogy and its poetic descendants, though they allow an entirely different and less empirical form of understanding, would allow them to examine the immediate and long-term cultural impact that Theoden had. And it would allow the historian to learn how Theoden's contemporaries were driven to feel by his life and loss.
So is that the purpose of mourning - to translate a living being into a mythic figure? To yield art from reality? Of course not; it has the capacity to do so and serves that role for certain characters, but the eulogy for Gandalf reveals a sort of mourning that we are all more personally familiar with. When the hobbits are in Lothlorien, constructing a song in memory of Gandalf, many of the verses don't evoke historical events, or deliver 'news' - they're expressions of the hobbits' personal memories of the wizard. And these especially include happy and joyful memories. Every funeral I've been to, whether for someone who lived a long, full life, or for someone whose life was tragically cut short, had at least a partial aim to celebrate the joy brought about in life by the one who had died. Frodo sings of Gandalf's tragic death, but in his next breath, Sam sings of the simple happiness of Gandalf's fireworks.
I'm sure this isn't a groundbreaking opinion, but I absolutely adore the description at the Field of Cormallen, which reads 'their hearts, wounded with sweet words, overflowed, and their joy was like swords, and they passed in thought out to regions where pain and delight flow together and tears are the very wine of blessedness.' It is a feeling understood, I think, by anyone who has known intense grief. And it captures the way in which grief and joy are two sides of the same coin. It is evocative of eucatastrophe - but I feel like it goes beyond eucatastrophe. It is the inherent complexity of emotion. For how can you grieve somebody without remembering, and thus feeling, the joy they brought you? And how can you be joyful without the memory of the sadness which the joy has driven away? We cry at weddings as often as we cry at funerals. And a song of praise and a eulogy require the same capacity to feel.
A cheesy old saying goes "Don't be sad because it's over - be happy because it happened." I would like to amend this to "Embrace your grief, which came from an End - but also embrace the joy that came with it."