$\frac{1}{x+1} + \frac{2}{x^2+1} + \frac{4}{x^4+1} + \cdots $ up to $n$ terms in terms of $x$ and $n$. There's a series which I can't seem to find a way to sum. Any help would be highly appreciated. It goes as follows      $$\frac{1}{x+1} + \frac{2}{x^2+1} + \frac{4}{x^4+1} + \cdots $$ up to $n+1$ terms.   The sum is to be expressed in terms of $x$ and $n$. I tried setting a formula for the $n$-th term and setting it into a difference but ran into a dead end.

By induction, it is pretty clear that
$$ x^{2^{n+1}}-1 = (x-1)\prod_{k=0}^{n} \left(x^{2^k}+1\right) \tag{A}$$
and by applying $x\cdot\frac{d}{dx}\log(\cdot)$ to both sides we have:
$$\frac{2^{n+1}x^{2^{n+1}} }{x^{2^{n+1}}-1}=\frac{x}{x-1}+\sum_{k=0}^{n}\frac{2^k x^{2^k}}{x^{2^k}+1} \tag{B}$$
and by replacing $x$ with $\frac{1}{z}$:
$$\frac{2^{n+1}}{1-z^{2^{n+1}}}=\frac{1}{1-z}+\sum_{k=0}^{n}\frac{2^k}{z^{2^k}+1}. \tag{C}$$
