I'm sure some of this is wrong, but should give you a general idea.
Inside the program (you can't see it, to know what's going on), the computer randomly generates numbers (a number from 1 to 1032, or something) each turn. This number called a "seed" is used to determine battle outcomes and any other random events.
So if one of your units is attacking an enemy, the computer will figure out what your chances of victory is (based on unit's strengths, terrain, etc.) and assign a number to it. If the seed or "die roll" is higher than the number that was picked for victory, your unit wins. If lower your unit loses, for example. Or the other way around, where the lower numbers are better, I'm not sure.
In current versions of the game, this 'seed' is selected BEFORE the save. So if you reloaded the game, and moved the exact same units, in the exact same sequence, the results would be the same. But it sounds like in 1.21f, you could reload and get a different seed, so the results may be different.