I will ask this question based on an example. Recently I was working on the sequences of natural numbers, where the general term of the sequence is given by a polynomial. For obtaining the partial sum of such a sequence, I know I had to find out the closed form solutions to sums like $\sum_{k=1}^{n}k$,$\sum_{k=1}^{n}k^2$,$\sum_{k=1}^{n}k^3$ and so on, for any natural power $x$. I started by solving the sum of natural numbers, which is just an arithmetic progression. The main problem I faced was with powers greater than $1$. I worked out a couple of formulae for degree $2$, but they only reduced the computation, they didn't give a closed form expression. It took my roughly four days to tell myself that I have to change my approach. Then, I applied my technique to degree $3$, and noticed that if I knew a closed form expression for degree $2$, I could calculate an expression for degree $3$ and vice-versa. Then I continued this work on degree $3$, and somehow got the expression for degree $2$. Now using this method I can work out an expression for any degree. Then I read a couple of proof techniques, one of them was the sum $$\sum_{k=1}^n{(k+1)^3-k^3}$$, which looks like a telescoping sum, but can be used to determine the solution for degree $2$. And upon looking closely, the method I came up with was just a different version of this. And it took me about a week to figure this out.
Now, I wonder if someone would have thought of this sum instantly, he would have solved it very faster, not like me who took a week. So, luck can play a game-changing role in research, can't it? But, I want to ask, as in this case, is a week taken by me too long or is it fine? And am I going the right way spending this much time on these problems?
I would not qualify your success as lucky, but rather as experimental, that is, based on failed attempts and looking closely at examples. The only thing where you have been lucky is that your assumption there was a closed form for your sums was right (it is far from always being the case: just think of a sum like $\sum_{n=1}^k {1\over n}$).
If you look back in history, mathematicians like Leibnitz, Newton, Euler, and the like were all doing a lot of experimental mathematics, trying to find closed forms like you or more generally mathematical formulas. All of this involved a lot of computation by hand and a lof of attempts before finding the right solution.