The code inside Age of Empires 2 is a mess. I understand budget and time limitations when the game was released but, in the time since, no one has sat down to clean the code. If you look around a little in the data file of the game, you will find animations that are never used, civilization bonuses that do nothing and even things actually in the game but with different names.
In summary: be prepared for frustration, for having to backtrack thorught the code several times until understanding how something works and for finding nonsense.
The best advice I can give you, that also served me, is to look for similar implementations to discover how they work. If you want to create a bonus that stacks through the ages, check how the Goths infantry cost works. If you want a bonus that gives a free technollogy, check how Turks get their free Chemistry or Light Cavalry upgrades.
Also, one can not go without citing Age of Kings Heaven. They have a section on modding articles with information on different parts of the modding process: simple things like creating units or graphics and convoluded ones like gold generating units. I did not need all the information there to start wor