just for fun integrate $\int \frac{1}{x^2+1}dx$ using Partial Fraction Decomposition on the one hand, clearly $$\int \frac{1}{x^2+1}dx=\arctan(x)+c$$ on the other hand using partial fraction decomposition $$\frac{1}{x^2+1}=\frac{A}{x+i} +\frac{B}{x-i}$$ with $A=1/(-2i)$ and $B=1/(2i)$ leading to 
$$\int \frac{1}{x^2+1}dx=\frac{-1}{2i}\ln(x+i)+\frac{1}{2i}\ln(x-i)$$ leading to the conclusion that [up to a constant..] 
$$\arctan(x) = \frac{-1}{2i}\ln(x+i)+\frac{1}{2i}\ln(x-i)$$
leading to two thoughts.. 
1) is there a flaw in above reasoning?
2) is there another way to verify that 
$$\arctan(x) = \frac{-1}{2i}\ln(x+i)+\frac{1}{2i}\ln(x-i) + c$$
other than taking derivatives on both sides.. 
 A: The form you got (up to an absolute value) is indeed correct. It may look confusing (what are imaginary numbers doing here?) but it is correct. To see this geometrically, construct a right triangle in the complex plane with base (real) $x$ and height of $i$. 
A: Hint:
let $$x=\tan u$$ so $$\arctan(\tan u)=u:0<u<\pi/2$$
then put $$\tan u=\frac{e^{ui}+e^{-ui}}{i(e^{ui}-e^{-ui})}$$
so you get $$u=\frac{1}{2i}\ln(\frac{(\frac{e^{ui}+e^{-ui}}{i(e^{ui}-e^{-ui})})-i}{(\frac{e^{ui}+e^{-ui}}{i(e^{ui}-e^{-ui})})+i})+c$$
A: ${\large x > 0}$:
$$
{\rm F}\left(x\right) = \int_{0}^{x}{{\rm d}z \over z^{2} + 1}
=
{1 \over 4{\rm i}}\int_{-x}^{x}{{\rm d}z \over z - {\rm i}}
-
{1 \over 4{\rm i}}\int_{-x}^{x}{{\rm d}z \over z + {\rm i}}
=
{1 \over 4{\rm i}}\int_{-x -{\rm i}}^{x - {\rm i}}{{\rm d}z \over z}
-
{1 \over 4{\rm i}}\int_{-x + {\rm i}}^{x + {\rm i}}{{\rm d}z \over z}
$$
Define $z^{-1} = \left\vert z\right\vert^{-1}{\rm e}^{-{\rm i}\phi\left(z\right)}$
where
$z \in \left\lbrace z' \in {\mathbb C}\ \ni\ z' \not=x\,,\ x\geq 0\right\rbrace$
and $0\ <\ \phi\left(z\right)\ <\ 2\pi$.
\begin{align}
\int_{-x - {\rm i}}^{x - {\rm i}}{{\rm d}z \over z}
&=
-\int_{-1}^{0^{+}}{{\rm i}\,{\rm d}y \over x + {\rm i}y}
-
\int_{x}^{-x}{{\rm d}x' \over x' - {\rm i}0^{+}}
-
\int_{0^{+}}^{-1}{{\rm i}\,{\rm d}y \over {\rm i}y}
\\[3mm]
\int_{-x + {\rm i}}^{x + {\rm i}}{{\rm d}z \over z}
&=
-\int_{1}^{0^{+}}{{\rm i}\,{\rm d}y \over x + {\rm i}y}
-
\int_{x}^{-x}{{\rm d}x' \over x' + {\rm i}0^{+}}
-
\int_{0^{+}}^{1}{{\rm i}\,{\rm d}y \over {\rm i}y}
\\[5mm]&
\end{align}
\begin{align}
&
\int_{-x - {\rm i}}^{x - {\rm i}}{{\rm d}z \over z}
-
\int_{-x + {\rm i}}^{x + {\rm i}}{{\rm d}z \over z}
=
-{\rm i}\,{\cal P}\int_{-1}^{0^{+}}{{\rm d}y \over x + {\rm i}y}
-
{\rm i}\,{\cal P}\int^{1}_{0^{+}}{{\rm d}y \over x + {\rm i}y}
\\[3mm]&
+
\int_{-x}^{x}\left({1 \over x' - {\rm i}0^{+}}
                  -
                  {1 \over x' + {\rm i}0^{+}}\right)\,{\rm d}x'
+
{\cal P}\int_{-1}^{1}{{\rm d}y \over y}
\\[3mm]&=
-{\rm i}\int_{-1}^{0^{+}}
{{\rm d}y
 \over
 \sqrt{x^{2} + y^{2}\,}\
 {\rm e}^{-{\rm i}\left\lbrack 2\pi - \Theta\left(x,y\right)\right\rbrack}}
-
{\rm i}\int^{1}_{0^{+}}
{{\rm d}y
 \over
 \sqrt{x^{2} + y^{2}\,}\
 {\rm e}^{-{\rm i}\Theta\left(x,y\right)}}
+
2\pi{\rm i}
\end{align}
where $\theta\left(x,y\right) \equiv \arctan\left(\left\vert y\right\vert/x\right)$
\begin{align}
&
\int_{-x - {\rm i}}^{x - {\rm i}}{{\rm d}z \over z}
-
\int_{-x + {\rm i}}^{x + {\rm i}}{{\rm d}z \over z}
=
-4{\rm i}\int^{1}_{0^{+}}
{\cos\left(\theta\left(x,y\right)\right)\over \sqrt{x^{2} + y^{2}\,}}\,{\rm d}y 
+
2\pi{\rm i}
=
-4{\rm i}\int^{1}_{0^{+}}{x \over y^{2} + x^{2}\,}\,{\rm d}y + 2\pi{\rm i}
\\[3mm]&=
-4{\rm i}\int_{0}^{1/x}{{\rm d}y \over y^{2} + 1} + 2\pi{\rm i}
\\[3mm]&{\large \Longrightarrow}\quad
{\rm F}\left(x\right) = -{\rm F}\left(1 \over x\right) + {\pi \over 2}
\end{align}
Then,
$$
{\rm F}\left(x\right)
=
{\large\int_{0}^{x}{{\rm d}x \over x^{2} + 1}
=
\arctan\left(x\right)\,, \qquad x > 0}
$$
A: You're trying to show ${\displaystyle \arctan(x) = -{1 \over 2i}\log{x + i \over x - i}}$ plus a constant. Notice that ${\displaystyle {x + i \over x - i}}$ is a complex number of modulus $1$, so is of the form $e^{i\theta}$ for some $\theta$. So you want to show that $\arctan(x) = -{1 \over 2}\theta$ plus some constant. Now draw $x + i$ and $x - i$ on the complex plane and create two triangles, the first with vertices $(0,0), (x,0),$ and $(x,1)$ and the second its reflection across the $x$ axis, with vertices $(0,0), (x,0),$ and $(x,-1)$. 
Then $\theta$ is the angle from $(x,1)$ to $(0,0)$ to $(x,-1)$, and from your picture you should be able to see that $\cot({\theta \over 2}) = x$. So 
$${\theta \over 2} = {\rm arccot}\,x$$
$$= {\pi \over 2} - \arctan x$$
So what you get is actually
$$\arctan x = {\pi \over 2} - {\theta \over 2}$$
