First admit that you are not perfect and that there may be mistakes in your own programs.
When you must find a bug somehow you need to narrow down to the exact spot where things go wrong.
If you were testing with large inputs then test first with few inputs only. Gradually add more inputs.
Insert code to show some messages throughout your program so that you can see what the program really does. Or use a debugger so that you can trace the execution path of your program and see how far it gets.
Each time you get closer to the bug, split the remaining code in half adding more messages or trace points.
Temporarily comment out parts of your code.