I've just started geocaching as well and have logged a few DNFs, but have managed to return to all but a few of them and find them on the second go-around.
Renegade Knight mentioned that it's good to stop looking as soon as it is no more fun. Probably good advice. But I've had a few challenging ones that I remained persistent with, even after about a half-hour of getting nearly upset that I couldn't find the cache. In those cases, finding the cache is then much sweeter and, sometimes, even more memorable.
One note that will help you for sure, when starting out, watch the difficulty and terrain ratings and go for larger-sized caches. Then work your way to smaller and more difficult ones. I found a 3-difficulty and 4-terrain over the weekend and was SO proud. But I never could have done that within my first few finds.