I formed a research agreement with an AI in Civ 5, and when it was about halfway done he attacked me. Is that money just gone for both of us, or can we resume it somehow once I've taught him a lesson?
The money you each put into the agreement is lost. This is not necessarily a bad thing - if you can trick someone into a research agreement before going to war, they will lose that money, which they could have used on defending themselves.
According to Wikipedia, the higher-level computer opponents will sometimes use this strategy.
GPT as BlueRaja mentioned is a good exploit for sure. Open borders also is a good trade or pretty much anything that pays out over multiple turns including your excess strategic resources. You'd think it would be a horrible idea to arm the enemy at your gates but once they declare war on you 1 of 2 things will happen:
Let's say you trade iron for gold to Montezuma just before he declares war on you... 1) He already had more reserve iron than swordsman/catapults/etc. on the field, meaning the excess iron you gave him provided no benefit, but he has now financed your defenses/fun budget. 2) Montezuma was actually able to increase his max number of (iron) units via the trade, but now that your supply of iron is cut off Montezuma will have a shortage of iron resulting in all of his swordsmen/catapults/etc. receiving a combat penalty until he is able to get back in the black. Also, he has now financed your defenses/fun budget.