The AI gets increasingly enormous boosts on higher difficulty levels, as far as I can tell for all of production, population and research. One of the biggest factors though is building new cities. If the AI is getting to its second city faster than you it will almost certainly be producing more research. After population hits 50 there is no benefit until population hits 150. A lot of city sites can't support a population of 150 without building food boosting buildings, and even if they can get to 150, it's slow to get there (about 87 turns), so it generally makes sense to start producing pioneers as soon as you go over 50 population, assuming you have reasonable city sites you can get to and defend. If a new city site has an essence slot with the spell that gives +1 research and also a study then you can easily double the amount of research you do. Building Studies is quite high on my priority list, because that +1 has quite a dramatic impact early in the game, and it's quite quick to research "Knowledge" or whatever it's called, as well as being on the way to Administration and other important Civilization techs. Don't forget that research is affected by unrest as well, so measures which reduce unrest will also increase your research. Library goodie huts give a handy +15 research, which is significant at the start of the game. Finally I also always trade my tech with the weakest AI I'm in contact with, although this is not completely clear cut, as the research you trade for does not go towards what you're actually researching. I tend to figure that it will be useful at some point though, even if not immediately.
In terms of dealing with AI stacks with much better weapons and armour than you, options include:
1) Tactical spells
2) Strategic spells; Freeze is one of the best, it's cheap and immobilizing the AI while you bring up troops at the same time as llowering the AI initiative can win you a battle but Tremor (also immobilizes), Wither and the fire one have their uses. It's worth knowing that Wither can be cast anywhere, so it's useful offensively, unlike the ones which can only be cast in your territory.
3) Elemental damage, i.e. cold and fire damage, most obviously from staff wielding troops. Staff troops with a few tank units protecting them can be very effective.
On the higher difficulty levels it becomes much harder to out-settle and out-research the AIs at the start of the game. Generally what I'm aiming for is to have at least one stack of troops that can win a battle against the AI, and at that point I don't mind particularly if I declare war on the AI or they declare war on me. If they have higher power and a different allegiance they will usually declare war eventually, and there are advantages to letting them attack you, i.e. you get more time to build up, you may get them to attack you in a city so you can use city defenders, or in yourm territory you can use strategic spells to weaken them before attacking. Kill two large stacks of the AI that you've weakened with strategic spells and I generally find it's fairly straightforward to take the AI's cities, as it takes time to replace its losses. However if you have built a strong enough attacking force that you think you can win an offensive war then you might as well get on with it. On the very highest levels the bonuses the AI gets are enormous, so time is almost certainly not on your side. I often find that the AI has built all buildings and reached level four or five population on the highest difficulty levels, so obviously if you can take and keep one of those cities it will be enormously helpful in building your empire.