Why units deserted?
Always keep an eye on your food and gold.
You don’t want to give your army a reason to leave the castle and their sovereign unprotected.
If you run out of food or gold your men will give you a warning about their intentions to leave your banners the upkeep shortage.
You will receive a message with the warning and the remaining time you have to gather enough food or gold.
If you do not provide resources in the given time it will cause your units to leave your banners. You will again receive a message about these actions as well as a information about the unit type and count. In case you have an income but its is not enough, only a the men you cannot afford to pay will abbandon you. For example if you have 100 gold income but spend 130 on upkeep, troops worth 30 gold of upkeep will leave.
Where do they go?
They can be found near your city:
Can I get them back?
This is not the end. Your men form a camp near the city. For a time you can buy their loyalty back if you've resolved the crisis.
Entering their camp lists all units that have left you, and makes available negotioation to hire them back at a greatly reduced cost from their original training price.
Deserters are only visible to their own sovereign for the first day. After which anyone can negotiate to buy their loyalty untill they disperse.