Did they have some sort of back up, did they just retreat?
This question is highly dependant on which era, region and even situation we discuss but in general terms, there are a few possible scenarios:
The entire unit wheels after the charge, goes back to their starting point to rearm with new spears/lances for a second charge.
The rider in question draws his sidearm, usually a one handed sword or mace. Almost all horsemen, regardless of era and theater) armed with some form of polearm also carry a sidearm for close combat.
In pursuit of a fleeing/broken unit it may be possible for the rider to turn back and retreive his weapon or turn back to the units starting point to gather a new weapon.
On a sidenote, many people carry a mental image of a cavalry charge as a close formation of galloping horsemen charging into another unit of cavalry or infantry and then becoming entangled in a desperate life and death struggle until one side is destroyed. This was relatively uncommon. Cavalry, both missile and melee variants, would frequently charge, clash and withdraw only to reform and repeat the process again.