A good, if morbid, question!
It depended, both on who won the battle, what terms were agreed to, and what your status was, and of course by what period of history we’re talking about.

(Key image here is actually in the center margin, ignore Harold for a second.)
If we take the Battle of Hastings, as an example, the field was not cleared by anyone in particular: the victorious Normans and their camp followers stripped the dead of their arms and armor and left the bodies for the crows, which was pretty common until the 12th century. If you came from the area you were fighting in, maybe your family would look for you and try to bury you. Maybe you’d get lucky and some monks might consider it the Christian thing to do. But chances are you were crowfood.
By contrast, by the time you get to the later period of the Hundred Years War or the Wars of the Roses, mass graves (often with people being buried in their armor) become the normal post-battle practice – according to some scholars due to the Black Death convincing everyone that manhandling corpses or leaving them in the open air was a Bad Idea. And of course, status played a big role here: one of the reason why anyone with status brought camp followers with them was for them to retrieve your body and bring it back home, or at the very least arrange for it to be buried at a nearby church with some ceremony, as opposed to being dumped in the pit.
As to who did this, well, this is one of the reasons why armies marched with camp followers: large labor force who could be pressed into doing the messy business, and you could get around paying them by letting them loot the dead.