<s>[INST] Find the formula for the sum: $1+3x^2+5x^4+7x^6+...+(2n+1)x^{2n}$ The formula is supposed to be valid for $x \neq \pm 1$.
Here is how I did it:
$$\bar{S}_n = \frac{d}{dx}\left( x+x^3+x^5+...+x^{2n+1} \right)$$
The term in the brackets is the geometric sequence. So call the sum up to term $x^{2n+1}$ as $S_n$, then:
$$S_n = \frac{x(1-x^{2n})}{1-x^2}$$
and so:
$$\bar{S}_n = \frac{d}{dx} \left( S_n \right)$$
which gives me:
$$\frac{2x^2 (1-x^{2n})}{(1-x^2)^2}+\frac{1}{1-x^2}\left( 1-x^{2n}(1+2n) \right)$$
apparently, that's wrong. Embarrassing I cannot solve such a simple problem.
 [/INST] Your sum is given by $$\frac{x^2 \left(-2 n x^{2 n}-3 x^{2 n}+2 n x^{2
   n+2}+x^{2 n+2}-x^2+3\right)}{\left(x^2-1\right)^2}$$
</s>