I propose the following solution as the most optimal. It is based on two assumptions.
We'll call the two sides Agent 1 (Humanity) and Agent 2 (Clippy).
Assumption 1: Agent 1 knows that Agent 2 is logical and will use logic to decide how to act and vise-versa.
This assumption simply means that we do not expect Clippy to be extremely stupid or randomly pick a choice every time. If that were the case, a better strategy would be to "outsmart" him or find a statistical solution.
Assumption 2: Both agents know each other's ultimate goal/optimization target (i.e. Agent 1 - saving as many people as possible, Agent 2 - making as many paperclips as possible).
This is included in the definition of the dilemma.
Solution: "Cooperate on the first round, and on succeeding rounds do whatever your opponent did last time, with the exception of the last (100th) round. Evaluate these conditions at the beginning of each round."
Any other solution will not be as optimal. Let's consider a few examples (worst-case scenarios):
1. Agent 1 cooperates. Agent 2 defects.
2..100 Agent 1 defects. Agent 2 defects.
1. Agent 1 cooperates. Agent 2 cooperates.
2..X Agent 1 cooperates. Agent 2 defects.
X..100 Agent 1 defects. Agent 2 defects.
1..99 Agent 1 cooperates. Agent 2 cooperates.
100. Agent 1 cooperates. Agent 2 defects.
So, in the worst case you "lose" 1 round. You can try to switch between cooperating and defecting several times, in the end one side will end up with only 1 "loss", as else will be equal.
Note that the solution says nothing about the 100th round (where the question of what to do only arises if both sides cooperated on the 99th round).
Followup to: The True Prisoner's Dilemma
For everyone who thought that the rational choice in yesterday's True Prisoner's Dilemma was to defect, a follow-up dilemma:
Suppose that the dilemma was not one-shot, but was rather to be repeated exactly 100 times, where for each round, the payoff matrix looks like this:
As most of you probably know, the king of the classical iterated Prisoner's Dilemma is Tit for Tat, which cooperates on the first round, and on succeeding rounds does whatever its opponent did last time. But what most of you may not realize, is that, if you know when the iteration will stop, Tit for Tat is - according to classical game theory - irrational.
Why? Consider the 100th round. On the 100th round, there will be no future iterations, no chance to retaliate against the other player for defection. Both of you know this, so the game reduces to the one-shot Prisoner's Dilemma. Since you are both classical game theorists, you both defect.
Now consider the 99th round. Both of you know that you will both defect in the 100th round, regardless of what either of you do in the 99th round. So you both know that your future payoff doesn't depend on your current action, only your current payoff. You are both classical game theorists. So you both defect.
Now consider the 98th round...
With humanity and the Paperclipper facing 100 rounds of the iterated Prisoner's Dilemma, do you really truly think that the rational thing for both parties to do, is steadily defect against each other for the next 100 rounds?