"For instance when they opened a grave did they know more or less by state and regiment which regiment the soldier was from?"
Probably not. If the grave was marked, they would have the information that was on the marker. And that's assuming that a marker had ever been put up, and that it was still there three or more years later, and that it was still readable. This was probably true in very few cases.
"Or were the bodies they exhumed unknown not only by name but by any identity at all?"
This would be the case in most instances.
"Does anyone know who first buried them and how it was done, individually, or seperated by regiment and state, or basically in common trenches without any distinction or records? And does anyone know where their original graves were before their later exhumation?
The short answer here is "No." The Union dead were left on the field, very few if any would have been buried before their units left the area. Some would have been buried separately, some in trenches, some where they fell, some moved to general burial sites. Just think mass confusion, with nobody in charge, and a lot of bodies that needed to be disposed of in a hurry. Regimental graves would have been coincidental - that is, if a bunch of men from a regiment died near each other, they'd likely be buried near each other. But they would not have been sorted out by the burial parties.
"Were they buried where they fell on the field of battle or were they gathered up and transported to another area for burial?"
Probably some of both.