Integral of $\frac{1}{x^2+4}$ Different approach underneath is a brief method of partial fractions integration on the problem given in the title
Using a standard trigonometric result it is known that:
$$ \int \frac{1}{x^2+4}dx=\frac{1}{2}\tan^{-1}(\frac{x}{2})+C$$
But also:
$$\frac{1}{x^2+4}=\frac{A}{x+2i}+\frac{B}{x-2i}$$
Hence using partial fractions,
$$1=A(x-2i)+B(x+2i)$$
Let $x=2i$ 
$$\therefore 1=4Bi$$
$$\text{Hence } B=\frac{-i}{4}$$
Let $x=-2i$ 
$$\therefore 1=-4Ai$$
$$\text{Hence } A=\frac{i}{4}$$
Hence,
$$\frac{1}{x^2+4}=\frac{i}{4(x+2i)}-\frac{i}{4(x-2i)}$$
Or,
$$\frac{1}{x^2+4}=\frac{i}{4}(\frac{1}{x+2i}-\frac{i}{x-2i})$$
Hence, it is quite easy to see that:
\begin{align*}
\int \frac{1}{x^2+4}dx &=\int \frac{i}{4}(\frac{1}{x+2i}-\frac{1}{x-2i}) dx\\
&=\frac{i}{4}\int \frac{1}{x+2i}-\frac{1}{x-2i} dx\\
&=\frac{i}{4}(\log(x+2i)-\log(x-2i))+C\\
\end{align*}
We know that the principal value of log of a complex number can be calculated by the following formula:
$$\log(x+yi)=\log(x^2+y^2)+arg(x+yi)$$
Hence,
\begin{align*}
\int \frac{1}{x^2+4}dx &=\frac{i}{4}(\log(x+2i)-\log(x-2i))+C\\
&=\frac{i}{4}(\log(x^2+4)+\arg(x+2i)-\log(x^2+4)-\arg(x-2i)+C\\
&=\frac{i}{4}(\arg(x+2i)-\arg(x-2i))+C\\
\end{align*}
Now, consider cases. If x is bigger than 0, the argument of a complex number is always defined as $\arg(x+yi)=\tan^{-1}(\frac{y}{x})$
So our integral becomes
$$\int \frac{1}{x^2+4}dx=\frac{i}{4}(\tan^{-1}(\frac{2}{x})-\tan^{-1}(\frac{-2}{x}))+C$$
And since arctan is an odd function
\begin{align*}
\int \frac{1}{x^2+4}dx&=\frac{i}{4}(2\tan^{-1}(\frac{2}{x}))+C\\&=\frac{i}{2}\tan^{-1}(\frac{2}{x})+C\\
\end{align*}
Now, if $x$ is less than $0$ and $y$ is less than $0$ then argument of a complex number becomes $\tan^{-1}(\frac{y}{x})-\pi$ and if $x$ is less than $0$ and $y$ is more than $0$ the argument becomes $\tan^{-1}(\frac{y}{x})+\pi$ Also as in a previous case becasue arctan is an odd function, the integral becomes
\begin{align*}
\int \frac{1}{x^2+4}dx&=\frac{i}{4}(\tan^{-1}(\frac{2}{x})-\tan^{-1}(\frac{-2}{x})+2\pi)+C\\
&=\frac{i}{4}(2\tan^{-1}(\frac{2}{x})+2\pi)+C\\
&=\frac{i}{2}\tan^{-1}(\frac{2}{x})+D
\end{align*}
Hence
$$\int \frac{1}{x^2+4}dx=\frac{i}{2}(\tan^{-1}\frac{2}{x}), x\in\mathbb R\ \land x\neq0$$
Now, obviously, it is not the same, as the trig identity, it has a pole at x=0 while the original integral doesn't and most importantly it is not a real number. This was done by me purely for recreational purposes but now it frustrates me. 
Can it be done this way? Did I basically did a mistake or maybe I missed something crucial?. thanks in advance.
EDIT
After using the correct definition of principal value of log and nice property about arctan (both given to me by you guys)
we know that 
$$\log(x+yi)=\frac{1}{2}\log(x^2+y^2)+i\arg(x+yi)$$
and hence
*** becomes 
$$\frac{i}{4}(i(\arg(x+2i)-\arg(x-2i)))$$
=$$\frac{-1}{4}((\arg(x+2i)-\arg(x-2i)))$$
So the answe becomes 
$$\int \frac{1}{x^2+4}dx=\frac{-1}{2}\tan^{-1}(\frac{2}{x})+D$$
And since $$\tan^{-1}(\frac{2}{x})=\frac{\pi}{2}-\tan^{-1}(\frac{x}{2})$$
the result is $$\int \frac{1}{x^2+4}dx=\frac{-1}{2}(\frac{\pi}{2}-\tan^{-1}(\frac{x}{2}))+D$$
OR$$\int \frac{1}{x^2+4}dx=\frac{1}{2}\tan^{-1}(\frac{x}{2})+E$$ as required
Thanks :)

Also
$$ tan^{-1}(\frac 2x )= cot^{-1}(\frac x2 ) = \frac \pi 2 -tan^{-1}(\frac x2 ) $$
