Sum $1+(1+x)^2+(1+x+x^2)^2+\cdots+(1+x+x^2+\cdots+x^{N-2})^2 $ Is there a way to find the sum the following series:
$$1+(1+x)^2+(1+x+x^2)^2+\cdots+(1+x+x^2+\cdots+x^{N-2})^2 \text{ ?}$$
Any ideas ? Perhaps someone knows already the result..
Thank you in advance for your time.

$$
1+(1+x)^2+(1+x+x^2)^2+\cdots+(1+x+x^2+...+x^{N-2})^2 = \sum_{i=0}^{N-2}(1+x+\cdots + x^i)^2$$
Let $x<1$, though same can be repeated for $x>1$ - we do not consider $x=1$ since the answer is straightforward in this case
$$\sum_{i=0}^{N-2}(1+x+\cdots + x^i)^2 = \sum_{i=0}^{N-2}\left(\frac{1-x^{i+1}}{1-x}\right)^2 = \frac{1}{(1-x)^2}\sum_{i=0}^{N-2}(1+(x^{i+1})^2-2x^{i+1}).$$
Thus, we have 
$$\sum_{i=0}^{N-2}(1+x+\cdots + x^i)^2 =  \frac{1}{(1-x)^2}(N-1+\sum_{i=0}^{N-2}(x^{i+1})^2-2\sum_{i=0}^{N-2}x^{i+1}).$$
Thus, the answer is 
$$\frac{1}{(1-x)^2}\left(N-1+\frac{1-x^{(2(N-1)})}{1-x^2}-2\frac{1-x^{N-1}}{1-x}\right)$$
For $x=1$, this is sum of $i^2$ from 1 to $N-1$, which is $(N-1)(N)(2N-1)/6$.
For $x>1$, it will be the same expression as for $x<1$.
