In Heroes 4, and perhaps even more so than in Heroes 3, the outcome of a battle depends not only on the player's skill but also on luck. For example, the fastest unit doesn't always go first; it's the one that rolls high for morale at the beginning of the round. Morale is determined randomly, and a unit's morale value only affects the probability of getting good or bad morale. So, even a good player can lose if they're unlucky.
And, of course, the outcome depends on choosing the right tactics in battle. Use one tactic – destroy the enemy and win the battle without losses. Use another – and you're completely defeated. Sometimes, a single wrong move (a wrong decision) can turn the tide of the game.
Considering these two factors, I want to add that you shouldn't fight every battle using the same template. Sometimes, you need to think and find a non-standard solution to what seems like an impossible situation.
Справочник по НоММ-4 http://handbookhmm.ru/pamyatka-dlya-heroes-iv.html
Памятка по НоММ-3 http://handbookhmm.ru/pamyatka-dlya-homm-iii.html
и HotA http://handbookhmm.ru/vyishla-obnovlennaya-pamyatka-dlya-homm-iii-hota.html