What is the integral of $\frac{2x+1}{x^2+1}$ I know the integral can be found by writing it as $$\frac{1}{x^2+1} +\frac{2x}{x^2+1}$$ This gives us an answer of $$\ln(x^2+4) +\frac{1}{2} \tan^{-1} \frac{x}{2}$$ However, when I let $x=2\tan u$, I get 
$$\frac{1}{2} \tan^{-1} \frac{x}{2} + 2\ln\left|\text{sec(tan}^{-1} \frac{x}{2})\right|$$ This can be simplified and will give the same results for large values of $x$ but not smaller values. What am I doing wrong. Sorry for the format, I am still trying to figure out Latex.

The way you integrated that function is wrong. And why would you use a u-substitution after you have completed the integration process? Here's what you should have gotten:
$$
\int\frac{2x+1}{x^2+1}\,dx=
\int\frac{2x}{x^2+1}\,dx+\int\frac{1}{x^2+1}\,dx=\\
\int\frac{1}{x^2+1}\frac{d}{dx}(x^2+1)\,dx+\tan^{-1}{x}\overset{u=x^2+1}=\\
\int\frac{1}{u}\,du+\tan^{-1}{x}=
\ln{|u|}+\tan^{-1}{x}=\\
\ln(x^2+1)+\tan^{-1}{x}+C.
$$
