Recently, an undergrad joined my research project, and I really feel that I won the lottery with this one. His project was supposed to be fairly straightforward, but we've been running into some unexpected obstacles, liking needing to rebuild executables. However, this morning he said that he's sort of glad things aren't working, because he feels that he's learning so much more this way. I am seriously lucky to have him working with me.
There are days when it seems that half (or most) of research depends on luck. Persistence is also important, but if you get lucky every nth time, it pays off to stick with it for at least n+1 times.
Of course, you still need to know how to take advantage of luck when it comes your way.