Wait... Wait a minute. Wasn't the AI supposed to "play to win"? I thought this was a very conscious design decision by Shafer and his crew? So there are really three possibilities here:
1. Teaming up with you was their best chance of winning (unlikely)
2. The AI is too stupid to figure out a good strategy
3. They game doesn't work the way it's supposed to work
It ought to have been, since what's the point in competition that doesn't play to win? As I've noted in the past I've seen little sign of it, though. However, I found today's game something of an exception - based on that experience I'd say it's not that the computer players aren't trying to win, it's that they aren't able to gauge how you're trying to win (unless it's by domination). I was going for a cultural victory on King, and playing a strategy that left me trailing in points throughout the game. I also had an island to myself, so I didn't invest heavily in military since the AI seems a bit scared of water - I've never experienced a full-blown invasion of my home continent from an overseas power in Civ V.
In this game, my closest neighbour was Egypt, who were going for a science victory. It was in their interests to be left alone, so they were offering declarations of friendship throughout the game.
Denmark turned out to be the other big player, already accumulating city-states. I'd only made sure I held Monaco, the state on my island (and a cultured one), so aside from competing financially for Monaco's favour at various points in the game, the Danes didn't seem to see me as a threat - and also eventually started offering declarations of friendship, perhaps to ensure noninterference in their war with Germany (whose main MO appeared to be trying to deny the Danes city-states by conquering them). At one point or another, both Egypt and Denmark tried to solicit my services in war, though I remained steadfastly neutral (I have also, in the past, run across AIs using war dec agreements to set me up against an enemy Civ and then declare peace themselves).
But I suspect they mostly ignored me because the computer had difficulty recognizing my passive accumulation of social policies as a threat; just enough military to tie up their resources if they attacked, but not enough to be a threat, no map presence as I was carefully avoiding settling areas where I could be I could be drawn into conflict (which set me behind in a previous game - against Egypt, in fact), and correspondingly low points. They didn't appear to actively try to beat me to any Wonders relevant to my victory condition - they did get Sydney Opera House while I was still building it, but probably only because I teched to Mass Media late.
It may also have had trouble identifying how a strategy can be changed; the UN was out in plenty of time to secure victory ahead of me. And if I'd stayed passively building up culture once I'd got my prerequisites, as perhaps the AI expected me to, it would have. Instead, not having any great need of technology or more culture at that point in the game, I just switched all my specialists to banks, markets and stock exchanges and turned my small number of highly developed cities to full wealth production (keeping just enough cultural development to secure advances on the Patronage tree, which hadn't been one of my five), allowing me to steal the votes that would have won Denmark the game.
All that aside, if the computer had genuinely played to win and played well, I was in no position to deny Egypt a science victory - for some reason that AI just didn't secure it.
It is great to see more people figuring out how to play this game without being massed DOWed on. The diplomacy works, a little vague at times, but it works. The real problem is the AIs lack of combat skills.
My last game on King was a pleasant surprise - I managed to be at peace with everyone (though only four civs) throughout the game, friendly with them all most of the time. Declarations of Friendship do seem to help.
The AI does diplomatically odd things, though - Denmark denounced Germany the turn they signed a research agreement (also the turn they'd signed a peace treaty), which is decidedly odd in principle. If Germany had indeed been "playing to win", they should have gone for a research agrement with me or the Egyptians, since neither of us had proven to be a threat.
Also, Egypt threw that game away - having made two spaceship components by the 1920s, and being unchallenged, it then proceeded to make no more at all, to the point that the game went on long enough for three sessions of haggling over city states in the UN (which Denmark reached late) and for me to complete the Utopia Project in the 2040s (having bribed Monaco and Belgrade successfully in the run-up to each UN vote - haggling over city states is a lot of fun, and very tense for a Civ experience, but they probably need to look into how this actually works in a turn-based game, since the last person/AI to play gets the final say in how the vote goes).