This is a somewhat wasteful one, but when I really really can't focus or make progress on untangling an issue or if I just want to fully understand a file, I will print out my code on paper and go through it with a red pen line by line. It's rare, but it works just like editing an essay. I notice things I wouldn't otherwise.