Functional equation $ f(x) + f\left(1-\frac{1}{x}\right) = \tan^{-1}(x) $ and definite integral 
Let $f(x)$ be a function $f :\mathbb{R}\to \mathbb{R}$ such that
$$ f(x) + f\left(1-\frac{1}{x}\right) = \tan^{-1}(x) $$
for all real $x$ except $0$.
Find $\int_0^1f(x)\ \mathrm dx$.

My approach till now:
Put $x = \frac{1}{x}$ in the functional equation and consider the domain of integration $(0,1)$ such that $\tan^{-1}\frac{1}{x} = \cot^{-1}(x)$ and add the original functional equation and the resulting equation after the substitution to get:
$$f(x) + f(1-x) = \frac{\pi}{2} - f\left(\frac{1}{x}\right) - f\left(1-\frac{1}{x}\right)$$
and integrate both sides from $0$ to $1$.
Let $I = \int_0^1f(x)\ \mathrm dx $, then LHS of above functional equation becomes $2I$. Now I am not able to evaluate the RHS, some $\frac{\ln(2)}{2}$ term always creeps up and doesn't gets cancelled and its not even in the answer.
Please help me with this problem.
 A: Let $g(x)=1-\frac1x$. Then $g(g(x))=\frac1{1-x}$ and $g(g(g(x)))=x$.
Thus,
$$
f(x)+f(g(x))=\tan^{-1}(x)\tag1
$$
$$
f(g(x))+f(g(g(x)))=\tan^{-1}(g(x))\tag2
$$
$$
f(g(g(x)))+f(x)=\tan^{-1}(g(g(x)))\tag3
$$
Since $2f(x)=(1)-(2)+(3)$, we get
$$
f(x)=\frac12\left(\tan^{-1}(x)-\tan^{-1}(g(x))+\tan^{-1}(g(g(x)))\right)\tag4
$$
As mentioned in comments, this function is not continuous:

What is interesting is that the derivative of this function is continuous (if we subtract $\frac\pi2$ from $f$ in $[0,1]$ to counter the jump discontinuities):

In any case,
$$
\begin{align}
&\int_0^1f(x)\,\mathrm{d}x\\
&=\frac12\left(\int_0^1\tan^{-1}(x)\,\mathrm{d}x-\int_0^1\tan^{-1}(g(x))\,\mathrm{d}x+\int_0^1\tan^{-1}(g(g(x)))\,\mathrm{d}x\right)\tag5\\
&=\frac12\left(\int_0^1\tan^{-1}(x)\,\mathrm{d}x-\int_{-\infty}^0\tan^{-1}(x)\,\mathrm{d}g(g(x))+\int_1^\infty\tan^{-1}(x)\,\mathrm{d}g(x)\right)\tag6\\
&=\scriptsize\frac12\left(\frac\pi4-\color{#C00}{\int_0^1\frac{x}{1+x^2}\,\mathrm{d}x}+\color{#090}{\int_{-\infty}^0\frac1{(1-x)\left(1+x^2\right)}\,\mathrm{d}x}+\frac\pi2-\color{#00F}{\int_1^\infty\frac{x-1}{x\left(1+x^2\right)}\,\mathrm{d}x}\right)\tag7\\
&=\frac12\left(\frac\pi4-\color{#C00}{\frac{\log(2)}2}
+\color{#090}{\frac\pi4}
+\frac\pi2-\color{#00F}{\frac{\pi-2\log(2)}4}\right)\tag8\\[3pt]
&=\frac{3\pi}8\tag9
\end{align}
$$
Explanation:
$(5)$: apply $(4)$
$(6)$: apply $g$ and $g\circ g$ to get $\tan^{-1}(x)$ in each integral
$(7)$: integrate by parts
$(8)$: evaluate the integrals by partial fractions
$(9)$: simplify
A: To long for a comment. (I'm afraid if my calculation be a little wrong. I'm in a hurry situation, sorry)
By your notations, we have
$$2I=\frac{\pi}{2}-\int_0^1f(\frac{1}{x})dx-\int_0^1f(1-\frac{1}{x})dx.$$
Take $\dfrac{1}{u}=1-\dfrac{1}{x}$, we have $x=\dfrac{u}{u-1}$, $dx=-\dfrac{du}{(u-1)^2}$ and $$\int_0^1f(1-\frac{1}{x})dx=-\int_0^\infty\frac{f(1/u)}{(u-1)^2}du$$
On the other hand, by letting $x=\dfrac{1}{u}$, we have
$$\int_0^1f(\frac{1}{x})dx=\int_1^\infty\frac{f(u)}{u^2}du=\int_0^\infty \frac{f(u-1)}{(u-1)^2}du.$$
