Finding the sum $\frac{x}{x+1} + \frac{2x^2}{x^2+1} + \frac{4x^4}{x^4+1} + \cdots$

Prove first that for any $x\in(-1,1)$ the identity $$ \frac{1}{1-x}=\prod_{k\geq 0}\left(1+x^{2^k}\right) \tag{1}$$ follows from a telescoping product or the fact that every $n\in\mathbb{N}^*$ has a unique representation in base-$2$. By considering $\frac{d}{dx}\log(\cdot)$ of both sides of $(1)$, we get: $$ \frac{1}{1-x} = \sum_{k\geq 0}\frac{2^k x^{2^k-1}}{1+x^{2^k}}\tag{2}$$ from which: $$\sum_{k\geq 0}\frac{2^k x^{2^k}}{1+x^{2^k}}=\color{red}{\frac{x}{1-x}}.\tag{3}$$


Essentially the same "trick" allows us to derive Euler pentagonal number theorem from Jacobi's triple product, for instance.


Evaluating $$\sum_{q\ge 0} \frac{2^q x^{2^q}}{1+x^{2^q}}$$

we obtain

$$\sum_{q\ge 0} 2^q \sum_{k\ge 0} (-1)^k x^{(k+1)2^q} = \sum_{n\ge 1} x^n \sum_{2^q|n} 2^q (-1)^{n/2^q-1}.$$

Now observe that

$$\sum_{2^q|n} 2^q (-1)^{n/2^q-1} = \sum_{p=0}^{v_2(n)} 2^p (-1)^{n/2^p-1}$$

where $v_2(n)$ is the exponent of the highest power of $2$ that divides $n.$ This is

$$-\sum_{p=0}^{v_2(n)-1} 2^p + 2^{v_2(n)} = - (2^{v_2(n)}-1) + 2^{v_2(n)} = 1.$$

because $n/2^p$ is even unless $p=v_2(n).$

(This also goes through when $n$ is odd and we have one value for $p$, namely zero.)

Hence the end result is

$$\sum_{n\ge 1} x^n = \frac{x}{1-x}.$$