Integrate the function Find the following integral,
$$I_n=\displaystyle\int (\arctan \theta)^n\ d\theta$$
Thinking that maybe there is some reduction formula, I tried using integration by parts but unable to derive it. Any help will be appreciated. 
Actually the problem that I have been struggling over for quite some time is of finding $I_2$. If it can be solved, that will also be of great help.
 A: The basic method for obtaining $\mathcal{I}_{1}$ is integration by parts:
$$\begin{align}
\mathcal{I}_{1}
&=\int\arctan{(x)}\,\mathrm{d}x\\
&=x\arctan{(x)}-\int\frac{x}{x^2+1}\,\mathrm{d}x\\
&=x\arctan{(x)}-\frac12\ln{\left(x^2+1\right)}+\color{grey}{constant}.\\
\end{align}$$

The strategy for obtaining $\mathcal{I}_{2}$ is similar, except this time we have to integrate by parts twice. Then, an explicit formula for the anti-derivative may be obtained in terms of a non-elementary special function known as the Clausen function:
$$\begin{align}
\mathcal{I}_{2}
&=\int\arctan^2{(x)}\,\mathrm{d}x\\
&=x\arctan^2{(x)}-\frac12\ln{\left(x^2+1\right)}\arctan{(x)}-\int\frac{x\arctan{(x)}-\frac12\ln{\left(x^2+1\right)}}{x^2+1}\,\mathrm{d}x\\
&=x\arctan^2{(x)}-\frac12\ln{\left(x^2+1\right)}\arctan{(x)}-\int\frac{x\arctan{(x)}}{x^2+1}\,\mathrm{d}x\\
&~~~~~ +\frac12\int\frac{\ln{\left(x^2+1\right)}}{x^2+1}\,\mathrm{d}x\\
&=x\arctan^2{(x)}-\frac12\ln{\left(x^2+1\right)}\arctan{(x)}-\frac12\ln{\left(x^2+1\right)}\arctan{(x)}\\
&~~~~~ +\frac12\int\frac{\ln{\left(x^2+1\right)}}{x^2+1}\,\mathrm{d}x+\frac12\int\frac{\ln{\left(x^2+1\right)}}{x^2+1}\,\mathrm{d}x\\
&=x\arctan^2{(x)}-\ln{\left(x^2+1\right)}\arctan{(x)}+\int\frac{\ln{\left(x^2+1\right)}}{x^2+1}\,\mathrm{d}x\\
&=x\arctan^2{(x)}-\ln{\left(x^2+1\right)}\arctan{(x)}+\int\ln{\left(\sec^2{\theta}\right)}\,\mathrm{d}\theta;~~x=\tan{\theta}\\
&=x\arctan^2{(x)}-\ln{\left(x^2+1\right)}\arctan{(x)}-2\int\ln{\left(\cos{\theta}\right)}\,\mathrm{d}\theta\\
&=x\arctan^2{(x)}-\ln{\left(x^2+1\right)}\arctan{(x)}+2\ln{(2)}\,\theta-\operatorname{Cl}_{2}{\left(\pi-2\theta\right)}+\color{grey}{constant}\\
&=x\arctan^2{(x)}-\ln{\left(x^2+1\right)}\arctan{(x)}+2\ln{(2)}\arctan{(x)}-\operatorname{Cl}_{2}{\left(\pi-2\arctan{(x)}\right)}+\color{grey}{constant}.\\
\end{align}$$
