Integrate $\frac{\arctan x}{x^2}\,\mathrm dx$ $$\int \frac{\arctan
(x)}{x^2}\,\mathrm dx$$ 
(I have a constant in front of the integral, but I figure it just distributes to each of the terms in the end answer, and simplified it for now).
I figured it would be a chance for using integration by parts. I let $u=\arctan x, du=\frac{1}{x^2+1}, dv=\frac{1}{x^2}, v=\frac{-1}{x}$.
I get then $$\frac{-\arctan (x)}{x} -\int\left( -\frac{1}{1+x^2}\right)\,\mathrm dx$$ I cancel out the negatives in front of the integral and what's in front of the 1.
So I do partial fractions, and find that $\frac{1}{x(x^2+1)}=\frac{A}{x}+\frac{B}{(x^2+1)}$. I get that A=1 and B=-1 by letting x=0 and x=1, respectively.
So I have the $\arctan (x)$, and $\int\left( -\frac{1}{1+x^2} ,dx\right)$, simple enough, I thought, which generates $\ln |x|$ and $-\arctan (x)$. Somewhere, this must be wrong, but I can't see where. Please help!

$$\int { \frac { \arctan { x }  }{ { x }^{ 2 } } dx } =-\int { \arctan { x } d\left( \frac { 1 }{ x }  \right)  } =-\frac { \arctan { x }  }{ x } +\int { \frac { dx }{ x\left( { x }^{ 2 }+1 \right)  }  } =\\ =-\frac { \arctan { x }  }{ x } +\int { \left[ \frac { 1 }{ x } -\frac { x }{ { x }^{ 2 }+1 }  \right] dx } =-\frac { \arctan { x }  }{ x } +\int { \frac { dx }{ x } - } \frac { 1 }{ 2 } \int { \frac { d\left( { x }^{ 2 }+1 \right)  }{ { x }^{ 2 }+1 }  } =\\ =-\frac { \arctan { x }  }{ x } +\ln { \left| x \right| - } \frac { 1 }{ 2 } \ln { \left( { x }^{ 2 }+1 \right) +C } $$
