Irish caoineadh < caoinim, "I lament" < OI caínim, coínim.
In Ireland, the invention of keening is attributed to the goddess Brigit, daughter of the Dagda. Her son Ruadan mac Bres was killed by the smith Goibniu for being a spy. He was pierced by a spear in front of her, and she let out the first keening heard in Ireland. After Brigid, all fairy women--bean sídhe--would keen for the dead in a like manner, especially those with ties to mortal families.
Keening is not simply wailing, though--it is a controlled use of high-pitched singing of laments performed by women who are trained in this art. These women are actually professionals, paid (usually in food and drink) to attend the wake.
Keening cannot be performed until the wake, when the soul is thought to have finally left the body. To sing while the soul may still be present would alert the hounds of hell, who might sweep down and grab the soul. This, of course, relates back to the pan-European concept of the Wild Hunt.
In the seventeenth century, the Catholic Church sought to ban keening, viewing it as pagan and undigified. While it was certainly pagan (though much folk custom usually is, if one can think of pagan as meaning an earth-based practice), it was not undignified.
From all reports, the practice of keening is dying out, as are most ancient customs these days.
1. On Brigit: "The Second Battle of Magh Turedh"--various websites
2. Etymology: www.dictionary.com
3. The practice of keening: "Keening of the Dead": http://www.geocities.com/CapitolHill/5567/keening.html