Let's say I am a french cuirasser in a battle during one of the Napoleonic wars and my horse is killed by a gunshot. I'm fine and not near any enemy soldiers. What do I do? Do I retreat to get another horse? Join the infantry or just sit the rest of the fight out? As always please alert me of any misunderstandings that may exist in my question.
This is highly situational. But roughly, here's what happens:
Do I want to go back to my side, join the enemy, or go AWOL? Desertion was a non-trivial issue on all sides.
Assuming I want to go back to the French side, how do I re-connect with friendly units? If you're lucky a fellow horseman may give you a ride on the back of his horse. Or, you join friendly infantry or artillery while you are dismounted.
When/if you make it back to your unit, then it depends on how the situation is. There are spare horses, but you may not be the highest priority for getting them. Higher ranked officers obvious get highest priority. Then more prestigious cavalry units. If there is no horse available for you then you'll be re-assigned a role, depending on need.
TLDR; logistics is a complicated thing and there is no one standard answer, it's situational and highly dependent on luck.