Find the sum to n term of the series. $1+3x+5x^2+7x^3................, X\ne1$ Here, $a=1, d=2, b=1, r=x$
\begin{align}
S_n&= \frac{ab}{1-r}+\frac{bdr(1-r{^n}^{-1})}{(1-r)^2}-\frac{[a+(n-1)d]br^n}{1-r}\\
S_n&=\frac 1 {1-x}+\frac{ 2x(1-x{^n}^{-1})} {(1-x)^2}-\frac{[1+(n-1)(2)]x^n} {1-  x}\\
&= \frac 1 {1-x}+\frac{2x}{(1-x)^2}-\frac {2x.x{^n}^{-1}}{(1-x)^2}-\frac{[1+2n-2]x^n}{(1-x)}\\
&= \frac 1 {1-x}+\frac{2x}{(1-x)^2}-\frac {2x^n}{(1-x)^2}-\frac{[2n-1]x^n}{(1-x)}\\
\end{align}
Is it correct. I have not got the answer, please show me how to move to this answer without skipping any line
$\frac {1-3x} {(1-x)^2}+\frac {2x^n}{(1-x)^2}-\frac{(2n-1)x^n}{(1-x)}$

Another way
\begin{align*}
1+3x+5x^2+7x^3+\cdots+(2n-1)x^{n-1}&=(1+2x+3x^2+4x^3+\cdots+nx^{n-1})\\&+x(1+2x+3x^2+\cdots+(n-1)x^{n-2})\\
&=\frac{d}{dx}(x+x^2+x^3+\cdots+x^n)\\&+x\frac{d}{dx}(x+x^2+x^3+\cdots+x^{n-1})\\
&=\frac{d}{dx}\left(\frac{x^{n+1}-x}{x-1}\right)+x\frac{d}{dx}\left(\frac{x^{n}-x}{x-1}\right)\\
\end{align*}
