How can one get the best possible result against a player of very different strength? I (about a 1500 player) once took White against a 2100 player, and played a Queen's Gambit. I lost of course, but the other player complimented my play. He said, "You played well for about 20 moves, and made a small mistake on the 21st, which I took advantage of."

It certainly helped that I was playing White, which is sort of a form of handicap.
(See Is there a way to use handicaps in chess to bridge the gap between players of different skill levels?)

I don't remember using a "book" variation, but played moves that seemed to follow common sense. Maybe I kept the game simple. Somehow, I managed to play "neck and neck" until I overlooked a combination that gave Black a pawn advantage.

Is it as simple as that, staving off defeat is a matter of not making mistakes? (I finally made one, although it wasn't obvious to me.) Or does the weaker player (with White, anyway) have to do something to keep the stronger player at bay, like seize and hold the initiative (which I tried, but probably failed to do)?

And to reverse the question, suppose you were playing someone of much less rated strength who was playing "even" with you, perhaps as the result of learning some book variation. Should you steer for complications, perhaps away from the book, into areas that your opponent might be less familiar with? Or should you just play your best game and count on him to make a mistake?
Statistically speaking, a 600 point rating disadvantage means that you have about a 3.07% chance of winning.  If you want to improve that, your best bet is to play a position that you are familiar with.  

This part of the answer might be more pertinent to a 2000 player playing a 2200 player
One way to do this is to play an opening that you know intimately.  If you have a pet line, this is the time to play it.  Especially if you've analyzed an unusual opening with a computer, this will shorten the odds.  Basically, the 3200+ rated computer will be playing your opponent for you.
Ok, that's it for opening preparation

One common suggestion is to randomize the position if you are the weaker player.  This makes a lot of sense.  Chances are that the stronger player is also better at endgames.  So you don't want to get to the endgame unless you will win easily.  I've frequently beaten lower rated players from an equal endgame or even an endgame where I'm a little worse.  

In a "randomized" position, usually multiple pieces are hanging, one or both kings are weak, and most of the pieces are still on the board.  Now, unfortunately, truly good players thrive in these positions, and they will work out all the complications.  But you're probably not playing a 2600+ grandmaster, so this is still not a bad idea.  In these random positions, both players will be forced to use most of their time to make their way along the "narrow path".[1]  Once the players are deep in time pressure, anything can happen.[2]  

This is NOT to say you should make bad moves.  If at any point you make inferior moves, well, the stronger opponent will probably take advantage of them.  Instead, just keep pieces on the board.  One trick you can use to complicate - when a piece is attacked, instead of moving it or defending it, just attack one of your opponent's pieces.  This is much easier said than done, but this will quickly complicate even a mundane position.



Ok, if you've made it this far, just a few more general thoughts.  The easiest way to beat a stronger player is to just get lucky.  Everyone has a bad day from time to time, you just have to be playing someone who happens to make a mistake and take advantage of it.  The key to this is to not make any terrible mistakes.  If you can stay in the game and not lose material, you can always win - even if you have a bad position.  

Double check every move before you make it.  If you see a move that you think wins, spend more time than usual, don't make this move quickly.  If you're right, being behind on the clock won't really matter.  If you're wrong, you won't make an inferior move.  One saying that I've always found helpful is "never play a blunder quickly" (source unknown).  

Personally, I'm not convinced that the right plan is to just complicate the position and hope.  While this is a good plan of last resort, everyone plays with the same 16 pieces.  Make solid moves, calculate everything you need to, and be inspired to play well.  Even if you lose, you'll learn far more from a well played game that you just barely lost than a game where one of the players blundered on move 12.



Lastly, some rules that have helped me against lower rated players in the past:  


Don't be afraid of endgames, even if it should be drawn with best play
Similarly, don't be afraid of equal positions
A small advantage is often enough to win, but even if you are down material, swindles are often possible, so don't give up.
Finally, as a stronger player, I've had good luck in complicated positions.  As likely as it is for a stronger player to blunder, it is even more likely for the lower rated player to also blunder.  




[1]: David Bronstein: "When you play against an experienced opponent who exploits all the defensive resources at his command you sometimes have to walk time and again, along the narrow path of 'the only move'."
[2]: Lev Alburt: (paraphrased from http://www.amazon.com/Chess-Rules-Thumb-Lev-Alburt/dp/1889323101) "Having 15 minutes when your opponent has 5 is worth 200 rating points."