The Dead Marshes are, frankly, really creepy. And a lot of the creepiness can’t be explained any more than just creepy magic stuff (as lame as that sounds.) In a way, I think the movie took a lot of the Dead Marshes descriptions too literally, because in the book it makes a bit more sense.
For example, the lights. In the movie they’re shown as literal flames burning over the water, but in the book, the description (from Sam’s point of view) is very different:
He first saw one with the corner of his left eye, a wisp of pale sheen that faded away; but others appeared soon after: some like dimly shining smoke, some like misty flames flickering slowly above unseen candles; here and there they twisted like ghostly sheets unfurled by hidden hands.
In the book they sound more to me like a sinister type of will-o-the-wisp (see the wiki page for an explanation of the phenomenon/folklore), and not so much literal, tangible flames. Either way, the only explanation we get is from Gollum, who when asked about the lights says “The tricksy lights. Candles of corpses, yes, yes. Don’t you heed them! Don’t look! Don’t follow them!” The description of “candles of corpses” is the best we get, and seem to tie the flames to something tangible, at least. Until we get a closer look at these corpses.
Soon after spotting the lights Sam gets a good look at the “faces in the water” On this topic Gollum’s explanation is a bit more helpful. First, he says that “You should not look in when the candles are lit”, implying that the faces are somehow temporary, based on the lights. Later on he explains that the bodies are those of the men, elves, and orcs who died in the Battle of the Last Alliance, and that the marshes have spread since then, and “swallowed up the graves.“
Sam argues that the bodies couldn’t have been there for thousands of years. He asks ”Is it some devilry hatched in the Dark Land?“ And Gollum answers:
“Who knows? Smeagol doesn’t know,” answered Gollum. “You cannot reach them. We tried once, yes, precious. I tried once; but you cannot reach them. Only shapes to see, perhaps, not to touch. No precious! All dead.”
So, my conclusion is that the bodies, and the flames, are more spiritual at this point than physical. Maybe it is some magic on Sauron’s part, or maybe these are spirits that ignored the call to the Halls of Mandos, who knows.
I can answer the question of who the elves are, though! In general, all the bodies are, like Gollum said, casualties of the Battle of Dagorlad at the end of the Second Age. But the elves we know specifically are the Silvan and Sindarin elves who charged prematurely (see this post for more details.) Even more specifically, the elves from Lorien. Their king, Amdir, died in the charge (along with Oropher), and in the Unfinished Tales we’re told that it’s his company of elves that Sam Frodo and Gollum travel through.
While in the book Frodo is mesmerized by the lights, he isn’t drawn into the water like he is in the movie. But my speculation, based on the importance the movie placed on that particular elf, is that it was supposed to be Amdir himself.
SOURCES: LOTR, The Unfinished Tales (“The History of Galadriel and Celeborn”)


