An Elegy is a type of poem that typically expresses a lament for the dead. Its roots are in traditional Greek metrical poetry and there were many written surrounding the deaths of famous figures. Elegies carried an emotional weight due to this subject matter, and their endings would normally be a type of consolation to give closure to those impacted by the death.
Many famous poets wrote elegies, seeing them as a way to explore the powerful emotion that is grief. Some famous elegies include Lycidas by John Milton, In Memoriam by Alfred Lord Tennyson, and When Lilacs Last in the Dooryard Bloom'd by Walt Whitman. Throughout history, elegies have commonly served as a literary expression of grief and serious reflections.
Regarding their poetic form, there are no rhyme rules for elegies, and it is rather the subject matter that defines them. Although, traditionally elegies will contain three separate parts, beginning with the initial lament, where the speaker expresses their grief and sorrow. The second is praise and admiration of the person speaking about their life and achievements, and then ending with the consolation and solace.
Elegy by Ambrose Bierce
The cur foretells the knell of parting day;
The loafing herd winds slowly o'er the lea;
The wise man homewards plods; I only stay
To fiddle-faddle in a minor key.