I was reading quite a few posts on how routed men would seek out safe places and once calmed down, reform. But how did this work for an army that was victorious (if it happened at all), did they return to the camp, did they rally, did they flee, etc.?
This is a pretty broad question but in general soldiers who ran away from battle would want to rejoin their comrades and especially so if they found out their side ended up winning the battle. The reason for this isn't necessarily that they really wanted to go on fighting the war but desertion was usually punished by death and although they could still be accused of desertion and executed if they returned after running away they would be much more likely to be forgiven if they came back voluntarily. This also depended on a lot of factors though. As Sun Tzu points out in The Art of War, soldiers are more likely to desert in their home territory where they know the country and can return to their homes and families while soldiers on long campaigns deep in enemy territory are much less likely to desert because they have no place else to go. Other factors that influenced whether soldiers returned would depend on how likely they thought it was that they would be executed. If a large unit of soldiers deserted as a group then they would be more likely to return together since it was less likely they would then be singled out and punished as individuals. Also if they knew their side was desperate for soldiers and was thus more likely to accept back deserters without punishment then they would be more likely to return.
Usually the winning side had much less deserters but sometimes the winning side could have a lot of deserters as well. One particular example I can think of where this happened was at the Battle of Lutzen in 1632 during the Thirty Years' War. This was a very chaotic and bloody battle and the Swedish king Gustavus Adolphus himself was killed during the battle and thousands of his soldiers deserted in the thick fog. The king's death was hushed up, however, and the Swedish army managed to rally and drive the Catholic army from the field in a Pyrrhic victory. In the next few weeks many of the Swedish soldiers who had deserted apparently drifted back and rejoined the army. A few might have been executed as an example but most were probably accepted back into the ranks because the Swedish army was depleted and desperate for manpower.