Slowly but surely, I start to understand the code, and why it behaves like it does. Or, at least I think I understand it, but I don't really trust myself to know whether I actually do understand it, so periodically I try to validate whether or not I am indeed understanding the code.
There's an old saying: "If you can't teach it, you don't know it".
So one of the exercises I use is to attempt to teach this new code to somebody else. This works best if you actually have a sucker^H^H^H^H^H^Hcolleague nearby and you can tediously bore that person with your attempts to explain the behavior of the code, while trying to answer their questions.
But even if you don't have such a resource, you can still practice this exercise: just go to a whiteboard or wiki page or blank PowerPoint preso or something similar, and try to type up some notes explaining how the new code works.
You'll find that as you try to explain it, you naturally start raising questions, and pursuing those follow-on questions leads you to improve your understanding.
Here's a nice short essay expressing this notion quite clearly; I like this summarization:
The act of teaching excels at revealing those gaps in our knowledge of a subject. This is especially true when a student asks good questionsNow I'm off to work on that wiki page...