<s>[INST] $\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.
 [/INST] Hint:
If $f(x)=\dfrac1{1+x}+\dfrac2{1+x^2}+\dfrac4{1+x^4}+\cdots+\text{ up to } n+1\text{ terms}$
$$\dfrac1{1-x}+f(x)=\dfrac1{1-x}+\dfrac1{1+x}+\left(\dfrac2{1+x^2}+\dfrac4{1+x^4}+\cdots+\text{ up to } n+1\text{ terms}\right)$$
$$=\dfrac2{1-x^2}+\dfrac2{1+x^2}+\left(\dfrac4{1+x^4}+\cdots+\text{ up to } n\text{ terms}\right)$$
$$=\dfrac4{1-x^4}+\dfrac4{1+x^4}+\left(\dfrac8{1+x^8}+\cdots+\text{ up to } n-1\text{ terms}\right)$$
</s>