Evaluation of $1-\frac{1}{7}+\frac{1}{9}-\frac{1}{15}+\frac{1}{17}-\dotsb$

Start with partial fractions

$$\frac{x^4+x^2+1}{(x^2+1)(x^4+1)} = \frac{A}{x^2+1}+ \frac{B x^2+C}{x^4+1}$$

Thus,

$$A+B=1$$ $$B+C=1$$ $$A+C=1$$

or $A=B=C=1/2$. Also note that

$$x^4+1 = (x^2+\sqrt{2} x+1)(x^2-\sqrt{2} x+1) $$

so that

$$\frac{x^2+1}{x^4+1} = \frac{P}{x^2-\sqrt{2} x+1} + \frac{Q}{x^2+\sqrt{2} x+1}$$

where $P=Q=1/2$. Thus,

$$\frac{x^4+x^2+1}{(x^2+1)(x^4+1)} = \frac14 \left [2 \frac1{x^2+1} + \frac1{(x-\frac1{\sqrt{2}})^2+\frac12} + \frac1{(x+\frac1{\sqrt{2}})^2+\frac12} \right ]$$

And the integral is

$$\frac12 \frac{\pi}{4}+ \frac14 \sqrt{2} \left [\arctan{(\sqrt{2}-1)}-\arctan{(-1)} \right ] + \frac14 \sqrt{2} \left [\arctan{(\sqrt{2}+1)}-\arctan{(1)} \right ]= \frac{\pi}{8} (\sqrt{2}+1) $$


For the second, you're doing fine. You need to use partial fractions for the integral you've gotten. $x^2 + 1$ is irreducible, but the $x^4 + 1$ may be giving you troubles.

Hint: $$x^4 + 1 = (x^2 + \sqrt{2}x + 1)(x^2 - \sqrt{2}x + 1) $$