I've noticed that the only time I get attacked by allies is when I share a border with them AND the city has a very weak garrison. If you're keeping a couple peasents and town watch next an enemy stack of 12 units then you're begging for it. Put yourself in their shoes. If you see a chance for a quick grab at territory and the possiblity of inflicting major damage before the enemy can regroup troops to fight then why not take the chance?

I think that if you war for a certain country for so long, the AI develops a great hate for you and would rather fight to the death then sue for peace. I remember sacking tons of Macedonian cities and them refusing to sign a ceasefire after a couple cities. This is also the case if you broke your agreements with them or other factions in the past.

Although there are cases where they are just retarded.