An AI will attack you when their diplomatic relationship goes negative enough. Sometimes that's -5, sometimes -7. So hover over their name in the score table and the relationship items will appear. That will give you a list of things that you can try. If the AI is happy with your past trades, then break some trades with him. Demand tribute. Trade wth his worst enemies. It's all listed there. Of course, if your power exceeds that of the AI, they may never become furious enough to declare war on you.