[Integral][Please identify problem] $\displaystyle\int \cfrac{1}{1+x^4}\>\mathrm{d} x$ Here is my attempt. The result is not right. Please help identify the issue(s).
$\displaystyle f(x)=\int\cfrac{1}{x^4+1}\>\mathrm{d}x$, let $x=\tan t$, we have $ \mathrm{d}x = \sec^2 t\>\mathrm{d}t,\> t=\tan^{-1} x\in\left(-\cfrac{\pi}{2},\cfrac{\pi}{2}\right)$
\begin{align}
\displaystyle f(\tan t)&= \int\cfrac{\sec^2 t\> \mathrm{d}t}{1+\tan^4 t}=\int\cfrac{\cos^2 t\> \mathrm{d}t}{\cos^4 t+\sin^4 t}=\int\cfrac{\cfrac{1+\cos 2t}{2}\> \mathrm{d}t}{(\cos^2 t+\sin^2 t)^2-2\sin^2 t\cos^2 t} \notag\\
&=\int\cfrac{1+\cos 2t}{2-\sin^2 2t} \>\mathrm{d}t
=\int\cfrac{\mathrm{d}t}{2-\sin^2 2t} + \cfrac 12\int\cfrac{\mathrm{d}\sin 2t}{2-\sin^2 2t} \notag\\
&=\int\cfrac{\sec^2 2t \>\mathrm{d}t}{2\sec^2 2t-\tan^2 2t} + \cfrac {\sqrt{2}}8\int\cfrac{1}{\sqrt{2}-\sin 2t} + \cfrac{1}{\sqrt{2}+\sin 2t}\>\mathrm{d}\sin 2t \notag\\
&=\cfrac 12\int\cfrac{\mathrm{d}\tan 2t}{2+\tan^2 2t} +\cfrac{\sqrt{2}}{8}\ln \cfrac{\sqrt{2}+\sin 2t}{\sqrt{2}-\sin 2t} \notag\\
&=\cfrac {\sqrt{2}}4 \tan^{-1} \cfrac{\tan 2t}{\sqrt{2}} +\cfrac{\sqrt{2}}{8}\ln \cfrac{\sqrt{2}+\sin 2t}{\sqrt{2}-\sin 2t} \notag
\end{align}
As $\tan 2t=\cfrac{2\tan t}{1-\tan^2 t}=\cfrac{2x}{1-x^2}, \cfrac{\sqrt{2}+\sin 2t}{\sqrt{2}-\sin 2t}=\cfrac{\sqrt{2}\sec^2 t+\tan t}{\sqrt{2}\sec^2 t-\tan t}=\cfrac{\sqrt{2}(x^2+1)+x}{\sqrt{2}(x^2+1)-x},$
$f(x)=\cfrac {\sqrt{2}}4 \tan^{-1} \cfrac{\sqrt{2}x}{1+x^2} +\cfrac{\sqrt{2}}{8}\ln \cfrac{\sqrt{2}(x^2+1)+x}{\sqrt{2}(x^2+1)-x}+c$
If the above holds, $\displaystyle \int_0^{\infty} \cfrac{\mathrm{d} x}{1+x^4}$ would be $0$, which is impossible(Should be $\cfrac {\sqrt{2}\pi}{4}$).
 A: Comparing to the method I used in the following, maybe the issue occurs when computing
$$
\int \frac {\mathrm dt} {2-\sin^2(2t)}.
$$ 
Then from now on $t$ cannot take the value $\pm \pi /4$ if we want to devide the numerator and the denominator by $\cos^2(2t)$. Now to compute the improper integral, we should take the limit $x \to 1^-$ and $x\to 1^+$ separately, since the result is discontinuous at $1$. Fundamental Theorem of Calculus may deduce the wrong result if we apply it to a discontinued antiderivative. So if we use the OP as the antiderivative, we should compute
$$
f(+\infty) - f(1^+) + f(1^-) - f(0),
$$ 
which would give the right result $\sqrt 2 \pi/4$. 
Conclusion: the computation in the OP is right, but when apply it to compute definite integral, we should split the interval at the point $1$. 
Appendix
I'm here to give another approach. We would introduce a conjugate pair. Assume $x \neq 0$. 
\begin{align*}
\int \frac {\mathrm d x} {1+x^4} 
&= \frac 12 \int \frac {1-x^2}{1+x^4} \mathrm dx + \int \frac {1+x^2}{1+x^4}\mathrm dx \\
&= \frac 12 \int \frac {x^{-2} - 1}{x^2+x^{-2 }} \mathrm dx + \frac 12 \int \frac {x^{-2} + 1}{x^2+x^{-2 }} \mathrm dx\\
&= -\frac 12 \int \frac {\mathrm d (x + x^{-1})} {(x+x^{-1} )^2 -2} \mathrm dx+\frac 12 \int \frac {\mathrm d(x-x^{-1})} {(x - x^{-1})^2 +2}\\
&= -\frac {\sqrt 2}8 \int \left( \frac 1 {x +x^{-1}-\sqrt 2} - \frac 1{x+x^{-1}+ \sqrt 2}\right)\mathrm d(x+x^{-1}) \\
&\phantom{==}+\frac {\sqrt2}4 \int \frac {\mathrm d(x - x^{-1})/\sqrt 2} {((x-x^{-1})/\sqrt 2)^2 +1} \\
&= \frac {\sqrt 2}8 \log \left( \frac {x + x^{-1}+\sqrt 2} {x +x^{-1}-\sqrt 2}\right) + \frac {\sqrt 2}4 \mathrm {arctan}\left( \frac {x-x^{-1}} {\sqrt 2}\right) + C \\
&= \frac {\sqrt 2}8 \log \left(\frac {x^2 +\sqrt 2 x + 1} {x^2 - \sqrt2 x +1}\right) +\frac {\sqrt 2}4 \mathrm{arctan} \left(\frac {x^2 -1}{\sqrt 2 x}\right) + C.
\end{align*}
If we use this as the result, then
$$
f(+\infty) - f(0) = \frac {\sqrt 2} 4 \left( \frac \pi 2 + \frac \pi 2\right) = \frac {\sqrt 2}4 \pi. 
$$
Also note that when $x \neq 0$,
$$
\arctan(x) + \mathrm{arccot} (x) = \mathrm {sgn} (x)\frac \pi 2 \implies \arctan (x) = \mathrm {sgn} (x)\frac \pi 2 + \arctan \left(-\frac 1x\right),
$$
so the OP is correct. 
A: First of all, you made a typo in the final answer — the correct answer must be
$$f(x)=\frac{\sqrt{2}}{4}\tan^{-1}\frac{\sqrt{2}x}{1\color{red}{-}x^2}+\frac{\sqrt{2}}{8}\ln\frac{\sqrt{2}(x^2+1)+x}{\sqrt{2}(x^2+1)-x}+C.$$
The next issue is the introduction of $\sec(2t)$ and $\tan(2t)$ when you switched to
$$\int\frac{\sec^2 2t\,\mathrm{d}t}{2\sec^2 2t-\tan^2 2t}$$
(as part of an expression). Both $\sec(2t)$ and $\tan(2t)$ are undefined at some points within the domain $\displaystyle t\in\left(-\frac{\pi}{2},\frac{\pi}{2}\right)$, viz. at $\displaystyle t=\pm\frac{\pi}{4}$. Therefore, the antiderivative you find in terms of $t$ is in fact a piecewise-defined function:
$$f(x(t))=\begin{cases}
\cfrac{\sqrt{2}}{4}\tan^{-1}\cfrac{\tan2t}{\sqrt{2}}+\cfrac{\sqrt{2}}{8}\ln\cfrac{\sqrt{2}+\sin 2t}{\sqrt{2}-\sin 2t}+C_1, \text{ if } t\in\left(-\cfrac{\pi}{2},-\cfrac{\pi}{4}\right); \\
\cfrac{\sqrt{2}}{4}\tan^{-1}\cfrac{\tan2t}{\sqrt{2}}+\cfrac{\sqrt{2}}{8}\ln\cfrac{\sqrt{2}+\sin 2t}{\sqrt{2}-\sin 2t}+C_2, \text{ if } t\in\left(-\cfrac{\pi}{4},\cfrac{\pi}{4}\right); \\
\cfrac{\sqrt{2}}{4}\tan^{-1}\cfrac{\tan2t}{\sqrt{2}}+\cfrac{\sqrt{2}}{8}\ln\cfrac{\sqrt{2}+\sin 2t}{\sqrt{2}-\sin 2t}+C_3, \text{ if } t\in\left(\cfrac{\pi}{4},\cfrac{\pi}{2}\right).
\end{cases}$$
Switching back to $x$ still creates a piecewise-defined function:
$$f(x)=\begin{cases}
\cfrac{\sqrt{2}}{4}\tan^{-1}\cfrac{\sqrt{2}x}{1\color{red}{-}x^2}+\cfrac{\sqrt{2}}{8}\ln\cfrac{\sqrt{2}(x^2+1)+x}{\sqrt{2}(x^2+1)-x}+C_1, \text{ if } x\in(-\infty,-1); \\
\cfrac{\sqrt{2}}{4}\tan^{-1}\cfrac{\sqrt{2}x}{1\color{red}{-}x^2}+\cfrac{\sqrt{2}}{8}\ln\cfrac{\sqrt{2}(x^2+1)+x}{\sqrt{2}(x^2+1)-x}+C_2, \text{ if } x\in(-1,1); \\
\cfrac{\sqrt{2}}{4}\tan^{-1}\cfrac{\sqrt{2}x}{1\color{red}{-}x^2}+\cfrac{\sqrt{2}}{8}\ln\cfrac{\sqrt{2}(x^2+1)+x}{\sqrt{2}(x^2+1)-x}+C_3, \text{ if } x\in(1,+\infty).
\end{cases}$$
At the points $x=\pm1$, these expressions are undefined, and so the corresponding integrals have to be treated as improper. In your case, the integral $\displaystyle \int_0^{+\infty}$ has to be split at the discontinuity at $x=1$:
$$\int_0^{+\infty}\cdots\,\mathrm{d}x=\int_0^1\cdots\,\mathrm{d}x+\int_1^{+\infty}\cdots\,\mathrm{d}x,$$
and then, when evaluating the antiderivative that you found, you'll have to take the one-sided limits from the left and from the right at $x=1$, which are NOT equal to each other! And that's probably the source of your wrong answer.
More specifically:
$$\lim_{x\to1^{-}}\frac{\sqrt{2}x}{1-x^2}=+\infty \implies \lim_{x\to1^{-}}\arctan\frac{\sqrt{2}x}{1-x^2}=\frac{\pi}{2},$$
while
$$\lim_{x\to1^{+}}\frac{\sqrt{2}x}{1-x^2}=-\infty \implies \lim_{x\to1^{-}}\arctan\frac{\sqrt{2}x}{1-x^2}=-\frac{\pi}{2}.$$
