I have two questions about the series of $$\tan^{-1}(x)$$ for $\lvert x\rvert >1$: How can we derive the 2 following series? $$\tan^{-1}(x)=\frac{\pi}{2} -\frac{1}{x} +\frac{1}{3x^3}-\ldots$$ for $x>1$. $$\tan^{-1}(x)=\frac{-\pi}{2} -\frac{1}{x} +\frac{1}{3x^3}-\ldots$$ for $x<-1$. I found a solution that integrate $$\frac{1}{x^2} \cdot \frac{1}{1+\frac{1}{x^2}} $$ from $ -\infty$ to $x$ to get the first series and from $x$ to $\infty$ to get the second series. Can I integrate $$\frac{1}{x^2} \cdot \frac{1}{1+\frac{1}{x^2}} $$ indefinitely then to get the constant value, I substitute by $x=\infty$ and $ x=-\infty$ so we get two different values for the constant hence we have two different series? Is this correct mathematically?
Second, I want to understand how can I relate $$\frac{-\pi}{2}$$ and $$\frac{-\pi}{2}$$ (which is the constant in the series) to the quadrant of the angle ..? So I put the first series in this form $$\tan\left(\frac{\pi}{2}+\theta\right)=x$$ and I put the second series in this form $$\tan\left(\frac{-\pi}{2}+\theta\right)=x$$ where $$\theta=-\frac{1}{x} +\frac{1}{3x^3}-...$$ But I don't know how to complete thinking?