How to prepare for an opponent How does one prepare for an opponent (OTB or Online)?  Do you go through recent games?  How far do you normally go back?  Would certain factors about an opponent dictate how you prepare for them?
There can be no one-size-fits-all as to how to prepare for an opponent, as this will depend greatly on the playing strengths of both the one preparing and the opponent, and what works for one person won't necessarily work for another. So I'm somewhat hesitant to answer at all, but I'm hoping that the following three vignettes of chess preparation will shed a little light on the matter for you, without being blatantly inaccurate or overly biased.

1. Bobby Fischer prepares for Boris Spassky. Leading up to the 1972 world championship match, Fischer famously immersed himself in a deep study of all Spassky games he could get a hold of, going as far back as he could, to the point that he basically knew all Spassky games on record inside and out. (See e.g. the mention and footage of his &quot;big red book of Spassky&quot; at 8:10 of this 60 Minutes report from 1972. The video's a little hazy, but you can make out that the book is Weltgeschichte des Schachs 27: Spassky.)

For someone of Fischer's prodigious talent and understanding, this kind of focused study could yield extremely useful insights in terms of both (1) concrete opening preparation for the match, and even (2) uncovering particular strengths/weaknesses in Spassky's middlegame and endgame play.

This is all well and good for grandmasters, as such particular preparation can be the best use of their time, especially as they necessarily have very strong general skills already. Most of us mere mortals, however, wouldn't be able to reap the same benefits from such an in-depth study of an opponent, for the simple reason that we don't understand enough about chess itself to truly glean much useful information from all that study, and besides, our time could be more efficiently spent improving our overall game. As to the specifics of preparation at that rarefied level of play, well, &quot;whereof one cannot speak, thereof one must be silent.&quot;
Nevertheless, here's an account of my own very limited personal experience down at my level, which should be taken with an enormous grain of salt.

2. A relatively strong amateur prepares for a particular opponent. Even if I found the idea of preparing for an opponent to be appealing (I very much do not), I still think it would usually be a mistake for someone of my level (~ 2100 USCF) to spend much time on a finely-grained study of a particular opponent (assuming one even has access to many of the opponent's previous games in the first place), for the basic reason I spelled out above: I don't know enough to draw the right conclusions.
Despite that, I have lately found myself facing many repeat opponents because I've been playing a lot at my local club, and without having set out specifically to do so, I have ended up getting a useful sort of individualized preparation from previous games. For instance, there is a fellow expert player who I've now faced 6 times. The first two games were hard-fought draws in which I was on the defensive each time, and somewhat fortunate not to lose. The crude knowledge I obtained about him from those games, and which has proved useful, was just (1) that he is very aggressive and seemingly always looking for a direct attack, and (2) that apparently I could outplay him when things were kept quiet.
In the 4 games since, I have 3 wins and 1 loss, but that loss was only because of a fingerfehler when playing out what would've been mate-in-3 during a time scramble (probably the only time I've ever been truly angry after a game). In terms of the objective chess play, things have gone very poorly on his end since my realization about how to approach him. We have nearly identical ratings, and I believe that my recent success against him can be directly attributed to this very rudimentary sort of &quot;preparation,&quot; namely: I know that if I play cautiously and sufficiently deaden the position against this opponent, then the resulting game suits me much more than it does him.

But that's as fine a point as someone like me can put on the matter: &quot;I like quiet, he likes chaos.&quot; Big whoop. This is of course a far cry from the sort of preparation Fischer carried out, but that's as it should be, and even so it has proved useful for my own modest purposes. An important point here is that this information is something that I discovered naturally in the course of playing this opponent, and was not something I devoted separate time and energy to figuring out (which I maintain will often be quite a waste of time).
Finally:

3. A novice prepares for a particular opponent. This really shouldn't happen, as the novice's energies should most definitely be focused on all-around improvement, rather than on any particular traits of an opponent's play. Taking what I wrote above a step further, the novice simply isn't equipped to draw many appropriate/useful conclusions at all from an opponent's earlier games, and should instead simply direct all effort toward playing good moves and a solid game.