The following are some examples for how the battle system works.
If the defender builds nothing the attacker will lose 1 army (one third of the defence level) and the attacker needs to kill one army to win the battle - so you must send at least three. If the defender built a fort or a population before you arrived the defence level would rise to 4, but that still kills only one and three armies are still enough. If the defender built an army the defence level is still only 4, but now the attacker has to kill two armies to win the battle. Now you only win if you send six armies (because you need enough to kill two).
Depending on your situation you might prefer to use six armies in two separate attacks and gamble on whether they succeed or not rather than send all six together and be sure.
If you used a MOVE against the same target, you risk losing 2 armies (half of the defence level, which will be 4 if the defender builds an army, pop or fort) but the attacker will win for sure by sending as few as four armies.
A MOVE action also has the advantage that the same armies could keep moving and make another attack afterwards (probe actions are sticky - move actions aren't). The same force could capture two or three areas, although you need to allow for losses at each stage.
The loss rate in an assault is one third, plus one third the difference. To kill the one defending army you need to send only 3 armies, but 3 armies would be wiped out by the defenders. Four would also be wiped out (one third of 9, plus a third of 9-minus-4). Five is the minimum attack that might work (losing the usual three plus a third of four, for a total of four, leaving one survivor). But now you need to account for what the defender might build at the start of the turn as well.
A better bet is to send eight armies. That's enough to kill two defending armies, and you only lose the three armies (which you can't avoid). Even if their defence level goes up to 10 that's not enough to get any extra for the difference in levels.
Most people don't bother making this calculation when attacking cities. They just send the same number of attackers as the defence level.
Different terrain would affect the calculations in all these cases - some terrain adds to the defence level, and some reduces the number of losses suffered by the defender. In difficult terrain you do better to use a spy and sabotage to remove the defending army so that sending a couple of attacking armies will probably be enough (the Gaelic kingdoms can use INVADE to do the same thing).
It's all different gain once you're attacking another player, mind. They move and raise armies etc the same way you do: right at the start of the turn you can hit them before they can add any defenders at all, but later on they could have done something a lot more drastic. And they might retreat, or set an ambush, or deploy their household - all kinds of things can happen.
When you're attacking against another player ambushes can make a big difference. Consider our usual MOVE of four armies against an area with a defence level of four - if the defender has set a successful ambush then the attacker will be wiped out. The defender knocks off two armies (half of four) plus the extra one for the ambush before the attacker gets to do anything and then it's one against four. Now the attacker doesn't manage to inflict a single loss while the defender bumps off the last attacker (it's a move action, so they count half the difference in strengths).