Series Expansion by differentiation We know that 1/(1-x) = 1+x+x^2+x^3+....x^n
Say we need to find a suitable function for the expansion x+x^2+x^3+x^4+....x^(n+1)
We would differentiate 1/(1-x) = 1+x+x^2+x^3+....x^n
This would yield 1/(1-x)^2 =  1 + 2x+3x^2+4x^3 +...+nx^(n-1)**
Multiplying it by x would yield x/(1-x)^2 = x + 2x^2 + 3x^3 + 4x^4 +...nx^n  Hence the respective function would be x/(1 - x)^2 = x + 2x^2 + 3x^3 + 4x^4 +...nx^n
But how would we obtain the function g[x] for the expansion 1+ 2x^2 + 3x^3 + 4x^4 +...

Your work is fine, now we just have to subtract $x$ and add $1$ that is
$$g(x)=\frac{x}{(1-x)^2}-x+1$$
