We have all seen a situation where one player is camping on a hill, then another player comes along with a big army and wipes them out. It's natural to ask which army truly has the advantage, because one has superior numbers, but the other has the hill advantage. More than that, it's also natural to ask, if the downhill army wins, whether the engagement was worth it or not. Using Lanchester's Laws, I would predict that archers can take a hill if there are 29% more of them than the enemy, and can win cost-efficiently if there are 33% more. Knights can also push up a hill against other knights, but they require 38% more to win, and 45% more to win cost-efficiently. I say "predict" because I haven't done any tests for this, but I am confident that the principles behind the calculations are valid. The real figures will vary by several percent, as there can be extra factors in each fight.
The theory of this question uses Frederick Lanchester's Laws of Combat. AoCBox has an introduction to Lanchester's Laws here (though note that you have to add a correction of 0.5 to all army sizes to make the calculations work). Given two army sizes A and B, a fight between them will reduce their numbers in such a way that
A^2-A'^2=r(B^2-B'^2)
Where A' and B' are the sizes of the armies after the fight and r is the relative killing efficiency of a unit in one army over the other. In order for a battle to result in a clear wipeout, we set A'=B'=0. This gives us the required initial army sizes for both armies to be defeated and find
A=sqrt(r)B
This shows that numbers matter more than quality. If one unit is twice as strong as units in the other army, they'll only be able to fight off 1.414 times as many soldiers on the other side. Now, if the two armies consist of the same units with the same upgrades, r will be equal to one, and A will be equal to B, as expected. However, if one army is sitting on a hill, they will deal 25% more net damage and take 25% less. This means they kill 1.25 times faster and die 0.75 times faster. Dividing the two gives a relative killing efficiency of 1.67. The square root of this is 1.29. This means when units fight from the top of a hill, they fight as if there were 29% more of them. Correspondingly, this means if you want to seize control of a hill, you will need 29% more units than you would need if you wanted to rout that same army on even ground.
There is one important snag in this calculation in that it doesn't take into account cost efficiency. You may will win the battle but lose the war because your opponent has more soldiers elsewhere than you have. If you have enough of an edge however, you can kill more units than you lose. To find where you break even, we use Lanchester's Laws again, but this time, we suppose that army A is larger, and they lose as many units as B. This means A'=A-B. The end result is that a fight is cost-efficient if
A/B=r/2+1/2
If you are fighting uphill against an army of the same unit type, then r=1.67 and A/B=1.33. Thus, if your army is 29% larger, you will cancel each other out and you will lose more units, but if your army is 33% larger, you will win while losing the same amount of units. When the two units cost different amount, cost-efficiency becomes more complicated to calculate, but the principle is the same. For the army you want to defeat, convert their resource cost into the amount of units you could have recruited with those resources and subtract that from your starting army. This is equivalent to insisting A'=A-wB, where w is the relative cost of units from army B to those of A. We eventually find
A/B=r/2w+w/2
If the ratio of army numbers exceeds this, you will trade cost-efficiently with your enemy.
Although these calculations are theoretical and each situation is subject to more complex information, there are still cases where these calculations can be used exactly. It is common in Arabian Hun wars for both sides to spam cavalry archers as soon as they reach the castle age. As both players will inevitably research ballistics, micromanagement becomes irrelevant. Assuming neither side deviates from this strategy, the game is normally decided on who engages better with their cavalry archers. On flat ground, whoever has more wins. However, strategic use of hills can prevent an opponent from pushing or can push villagers off resources. In these circumstances, judging the impact of hills is crucial. If you have 29% more cavalry archers than your opponent, then you can take that hill if you want it that badly, but it will cost you in the short term. Correspondingly, if you have 33% more cavalry archers, your opponent may want to get the hell out of there.
It's worth noting that Lanchester's Laws apply differently to ranged units compared to physical units. Lanchester's Square Law applies well for projectiles because each unit can focus down units from the other army, whereas units with no range can only engage units around them. This doesn't count for much in small engagements, but it does in larger numbers, where flanks become important. I like to use a modified version of Lanchester's Laws for this, using the exponent 1.585 (this is the logarithm of 3 with the base 2). This gives
A^1.585-A'^1.585=r(B^1.585-B'^1.585)
So if you have a formation of knights pushing uphill against your opponent's knights, you can win if you have (5/3)^(1/1.585)=1.38 times more knights than them. To do so cost-efficiently is more difficult to determine precisely, but I would estimate that having 45% more knights would be enough to do it. Either way, these calculations are a guideline to engaging the right fights, but taking into account other factors will require looser estimates. However, these numbers should provide a starting point.
The theory of this question uses Frederick Lanchester's Laws of Combat. AoCBox has an introduction to Lanchester's Laws here (though note that you have to add a correction of 0.5 to all army sizes to make the calculations work). Given two army sizes A and B, a fight between them will reduce their numbers in such a way that
A^2-A'^2=r(B^2-B'^2)
Where A' and B' are the sizes of the armies after the fight and r is the relative killing efficiency of a unit in one army over the other. In order for a battle to result in a clear wipeout, we set A'=B'=0. This gives us the required initial army sizes for both armies to be defeated and find
A=sqrt(r)B
This shows that numbers matter more than quality. If one unit is twice as strong as units in the other army, they'll only be able to fight off 1.414 times as many soldiers on the other side. Now, if the two armies consist of the same units with the same upgrades, r will be equal to one, and A will be equal to B, as expected. However, if one army is sitting on a hill, they will deal 25% more net damage and take 25% less. This means they kill 1.25 times faster and die 0.75 times faster. Dividing the two gives a relative killing efficiency of 1.67. The square root of this is 1.29. This means when units fight from the top of a hill, they fight as if there were 29% more of them. Correspondingly, this means if you want to seize control of a hill, you will need 29% more units than you would need if you wanted to rout that same army on even ground.
There is one important snag in this calculation in that it doesn't take into account cost efficiency. You may will win the battle but lose the war because your opponent has more soldiers elsewhere than you have. If you have enough of an edge however, you can kill more units than you lose. To find where you break even, we use Lanchester's Laws again, but this time, we suppose that army A is larger, and they lose as many units as B. This means A'=A-B. The end result is that a fight is cost-efficient if
A/B=r/2+1/2
If you are fighting uphill against an army of the same unit type, then r=1.67 and A/B=1.33. Thus, if your army is 29% larger, you will cancel each other out and you will lose more units, but if your army is 33% larger, you will win while losing the same amount of units. When the two units cost different amount, cost-efficiency becomes more complicated to calculate, but the principle is the same. For the army you want to defeat, convert their resource cost into the amount of units you could have recruited with those resources and subtract that from your starting army. This is equivalent to insisting A'=A-wB, where w is the relative cost of units from army B to those of A. We eventually find
A/B=r/2w+w/2
If the ratio of army numbers exceeds this, you will trade cost-efficiently with your enemy.
Although these calculations are theoretical and each situation is subject to more complex information, there are still cases where these calculations can be used exactly. It is common in Arabian Hun wars for both sides to spam cavalry archers as soon as they reach the castle age. As both players will inevitably research ballistics, micromanagement becomes irrelevant. Assuming neither side deviates from this strategy, the game is normally decided on who engages better with their cavalry archers. On flat ground, whoever has more wins. However, strategic use of hills can prevent an opponent from pushing or can push villagers off resources. In these circumstances, judging the impact of hills is crucial. If you have 29% more cavalry archers than your opponent, then you can take that hill if you want it that badly, but it will cost you in the short term. Correspondingly, if you have 33% more cavalry archers, your opponent may want to get the hell out of there.
It's worth noting that Lanchester's Laws apply differently to ranged units compared to physical units. Lanchester's Square Law applies well for projectiles because each unit can focus down units from the other army, whereas units with no range can only engage units around them. This doesn't count for much in small engagements, but it does in larger numbers, where flanks become important. I like to use a modified version of Lanchester's Laws for this, using the exponent 1.585 (this is the logarithm of 3 with the base 2). This gives
A^1.585-A'^1.585=r(B^1.585-B'^1.585)
So if you have a formation of knights pushing uphill against your opponent's knights, you can win if you have (5/3)^(1/1.585)=1.38 times more knights than them. To do so cost-efficiently is more difficult to determine precisely, but I would estimate that having 45% more knights would be enough to do it. Either way, these calculations are a guideline to engaging the right fights, but taking into account other factors will require looser estimates. However, these numbers should provide a starting point.