<s>[INST] Finding the sum of $1+4k+9k^2+...+n^2k^{n-1}$ I'm having trouble using Abel's summation formula as $a_1b_1+a_2b_2+...+a_nb_n=(a_1-a_2)(b_1)+(a_2-a_3)(b_1+b_2)+...+(a_{n-1}-a_n)(b_1+b_2+...+b_{n-1})+a_n(b_1+b_2+...+b_n)$
to find the sum of $1+4k+9k^2+...+n^2k^{n-1}$.
I know $1+2k+3k^2+...+nk^{n-1}=\frac{nk^n}{k-1}-\frac{k^n-1}{(k-1)^2}$ from a previous part.
Applying Abel's formula once I get $(-3)(1)+(-5)(1+k)+...-(2n-1)(1+k+k^2+...+k^{n-2})+n^2(1+k+k^2+...+k^{n-1})$
Then I think the next step is to apply it again to get $-2(1)-2(1+1+k)-...-2(1+(1+k)+(1+k+k^2)+...+(1+k+k^2+...+k^{n-3}))+(2n-1)(1+(1+k)+...+(1+k+...+k^{n-2}))+n^2\left(\frac{k^n-1}{k-1}\right)$
$=-2[1+(1+1+k)+(1+1+k+1+k+k^2)+...+(1+(1+k)+...+(1+k+..+k^{n-3}))]+(2n-1)((n-1)+(n-2)k+...+(n-(n-1))k^{n-2})+n^2\left(\frac{k^n-1}{k-1}\right)$
$=-2[1+(1+1+k)+(1+1+k+1+k+k^2)+...+(1+(1+k)+...+(1+k+..+k^{n-3}))]+(2n-1)\left(n\left(\frac{k^{n-1}-1}{k-1}\right)-\frac{(n-1)k^{n-1}}{k-1}+\frac{k^{n-1}-1}{(k-1)^2}\right)+n^2\left(\frac{k^n-1}{k-1}\right)$
$=-2[1+(1+1+k)+(1+1+k+1+k+k^2)+...+(1+(1+k)+...+(1+k+..+k^{n-3}))]+(2n-1)\left(\frac{k^{n-1}-n}{k-1}+\frac{k^{n-1}-1}{(k-1)^2}\right)+n^2\left(\frac{k^n-1}{k-1}\right)$
$=-2[1+(1+1+k)+(1+1+k+1+k+k^2)+...+(1+(1+k)+...+(1+k+..+k^{n-3}))]+\frac{2n-1}{(k-1)^2}\left(k^n-nk+n-1\right)+n^2\left(\frac{k^n-1}{k-1}\right)$
My problem arises when trying to find $[1+(1+1+k)+(1+1+k+1+k+k^2)+...+(1+(1+k)+...+(1+k+..+k^{n-3}))]$, it feels way too contrived and the sums within a sum thing is confusing me, I feel like I'm not taking the right approach, if anyone has a faster way using this formula that would be greatly appreciated.
By the way the solution is $\frac{n^2k^n}{k-1}-\frac{(2n-1)k^n+1}{(k-1)^2}+\frac{2k^n-2}{(k-1)^3}$
 [/INST] Hint
In one hand,
$$S_n(x)=\sum_{k=1}^nkx^k=x\cdot \frac{d}{dx}\sum_{k=0}^nx^k.$$
Finally,
$$\text{Your sum}=\frac{d}{dx}S_n(x).$$
</s>