<s>[INST] Another way to find the sum $S=1-\dfrac{3}{2}+\dfrac{5}{4}-\dfrac{7}{8}+\cdots+(-1)^{n-1}\cdot\dfrac{2n-1}{2^{n-1}}$ I want to know the sum
$$S=1-\dfrac{3}{2}+\dfrac{5}{4}-\dfrac{7}{8}+\cdots+(-1)^{n-1}\cdot\dfrac{2n-1}{2^{n-1}}.$$ This is my way.
First, we find the sum
$$1 + 3 x + 5x^2 + \cdots + (2n-1) \cdot x^{n-1}=\sum _{k=1}^n (2 k-1) x^{k-1}.$$
We have
$$\sum _{k=1}^n (2 k-1) x^{k-1} = 2\sum _{k=1}^n k\cdot x^{k-1}-\sum _{k=1}^n  x^{k-1}. $$
Note that
$$\sum _{k=1}^n k\cdot x^{k-1} = \left (\sum _{k=1}^n x^k\right)' = \left (\dfrac{x\left(x^n-1\right)}{x-1}\right)'=\dfrac{n x^{n+1}-(n+1)x^n+1}{(x-1)^2}.$$
Another way
$$\sum _{k=1}^n  x^{k-1} = \dfrac{x^n-1}{x-1}.$$
From the above results, we have
$$1 + 3 x + 5x^2 + \cdots + (2n-1) \cdot x^{n-1}= \dfrac{(2 n-1) x^{n+1}-(2 n+1)x^n+x+1}{(x-1)^2}.$$
With $x=-\dfrac{1}{2}$,we get
$$S=\dfrac{2^n + (-1)^{n+1} \cdot(6n+1)}{9 \cdot 2^{n-1}}.$$
How to find the result with another way?
 [/INST] The general term of your series is on the form $(-1)^{n-1}\frac{2n-1}{2^{n-1}} = -4nx^n  + 2x^n$ where $x = -\frac{1}{2}$. When summed the latter term gives rise to a geometrical series and for the former note that $$(1-x)\left[x + 2x^2 + 3x^3 + 4x^4 + \ldots + nx^n\right] = x+x^2+x^3+\ldots+x^{n} - nx^{n+1}$$ which is just another geometrical series. This gives you
$$\sum_{k=1}^n-4kx^k + 2x^k = -4\frac{\left(g_n(x) - nx^{n+1}\right)}{1-x} + 2g_n(x)$$
where $g_n(x) = x+x^2+\ldots+x^n =\frac{x-x^{n+1}}{1-x}$. Taking $x=-1/2$ gives the same result as you have found already.
</s>