Explain your code to someone (or something, like a rubber duck). The act of explaining often reveals the bug.
As you describe what each line does, you might say "and here it should..." and realize it doesn't. Many bugs are found by simply talking through the code.