the main thing to know about AI - it is STUPID. So, it will keep attacking you more or less along the same paths, with minimal variations. If you play on a map with high hills and narrow paths you can easily predict where he will attack. Your units will usually be smart enough to figure out what to do vs AI on their own (AI does not micromanage its units)
Another thing about AI is that it will build metal extractors and power plants very quickly. So, even if your units are very efficient at killing his, you still need to have at least 70% of its economic power to beat it. Building extractors and solar plants will get you there, but you also have to spend the build power somehow. Best way to practice is to start a sandbox game and try to figure out how to build e.g. 100 glaives as fast as possible, and then move up into getting 100 zeuses as fast as possible. Once you know those basic economy tricks you'll be able to sustain the economy on the level sufficient to beat AI.
For inspiration you may watch youtube channel by shadowfury333, he casts some guides and team games.