Probability indeed. Simplifying, base odds are like this. Tank has 16 attack, spear 2 defense. For 1 round of combat (1 hitpoint that is) this is 16/18 chance the tank wins, 2/18 = 1/9 the spear wins. Assuming 4 hitpoints for each unit the math gets more complicated and you have to sum over all possible sequences of wins/losses until one of the unit has 0 hitponts. This favours the strong unit heavily. For example, using Bomberescorts combat calculator (yeah, I know, I'm lazy):
1hp tank - 1hp spear: win 88%, loss 12%, retreat 0%
2hp tank - 2hp spear: win 91.6%, loss 2.8%, retreat 5.6%
3hp tank - 3hp spear: win 97.3%, loss 0.9%, retreat 1.8%
4hp tank - 4hp spear: win 99%, loss 0.3%, retreat 0.7%
The math is actually more complicated because terrain, fortification, walls, cities, and defending behind a river all give defensive bonuses. That benefits the defending unit.
Spear fortified in city on flat land: 4hp tank - 4hp spear: win 96.1%, loss 1.2%, retreat 2.5%.
Spear fortified in metropolis on flat land: 4hp tank - 4hp spear: win 93.3%, loss 2.3%, retreat 4.3%.