How are XP calculated in LH?
If you're asking how the base experience for a battle is calculated, we have no idea. It's dependent on the type and level of your opponent, the difficulty rating of the army, and perhaps your army's difficulty rating and unit levels, but that's about all I know.
If you are asking how the experience for the battle is divided up among participating units:
There is some base experience gain for the battle, dependent on the things I mentioned above and which we don't know how to calculate. We'll call this value B. If there are C champions present in the battle, each champion receives (B/C)Mc experience for the fight, where Mc is the experience modifier for champion c. Trained troops receive min(B/2, B/(2C))*Mt, where Mt is the experience modifier for troop unit t. Mt is affected by a handful of champion traits (General and Trainer I-III), by the Potential trait available in unit design, and by a unit enchantment, but not by anything else I can think of, while Mc is affected by some traits, equipment, and an enchantment. I believe, but I am not certain, that fractional experience values are rounded off, and that the minimum experience gain per battle is 1 as long as the unit survives and the opposing force is defeated. A champion who falls during a battle won by their army will not receive any experience for that battle, though he or she will still count towards the number of champions participating in the battle.