In the arctangent formula, we have that:

however, only for $uv<1$. My question is: where does this condition come from? The situation is obvious for $uv=1$, but why the inequality?

One of the possibilities I considered was as following: the arctangent addition formula is derived from the formula:

Hence, if we put $u=\tan{\alpha}$ and $v=\tan{\beta}$ (which we do in order to obtain the arctangent addition formula from the one above), the condition that $uv<1$ would mean $\tan\alpha\tan\beta<1$, which, in turn, would imply (thought I am NOT sure about this), that $-\pi/2<\alpha+\beta<\pi/2$, i.e. that we have to stay in the same period of tangent.

However, even if the above were true, I still do not see why we have to stay in the same period of tangent for the formula for $\tan(\alpha+\beta)$ to hold. I would be thankful for a thorough explanation.

If $\arctan x=A,\arctan y=B;$ $\tan A=x,\tan B=y$

We know,

So,
where $n$ is any integer

As the principal value of $\arctan z$ lies $\in[-\frac\pi2,\frac\pi2], -\pi\le\arctan x+\arctan y\le\pi$

$(1)$ If $\frac\pi2<\arctan x+\arctan y\le\pi, \arctan\left(\frac{x+y}{1-xy}\right)=\arctan x+\arctan y-\pi$ to keep $\arctan\left(\frac{x+y}{1-xy}\right)\in[-\frac\pi2,\frac\pi2]$

Observe that $\arctan x+\arctan y>\frac\pi2\implies \arctan x,\arctan y>0\implies x,y>0$

$\implies\arctan x>\frac\pi2-\arctan y$
$\implies x>\tan\left(\frac\pi2-\arctan y\right)=\cot \arctan y=\cot\left(\text{arccot}\frac1y\right)\implies x>\frac1y\implies xy>1$

$(2)$ If $-\pi\le\arctan x+\arctan y<-\frac\pi2, \arctan\left(\frac{x+y}{1-xy}\right)=\arctan x+\arctan y+\pi$

Observe that $\arctan x+\arctan y<-\frac\pi2\implies \arctan x,\arctan y<0\implies x,y<0$

Let $x=-X^2,y=-Y^2$

$\implies \arctan(-X^2)+\arctan(-Y^2)<-\frac\pi2$
$\implies \arctan(-X^2)<-\frac\pi2-\arctan(-Y^2)$
$\implies -X^2<\tan\left(-\frac\pi2-\arctan(-Y^2)\right)=\cot\arctan(-Y^2)=\cot\left(\text{arccot}\frac{-1}{Y^2}\right)$

$\implies -X^2<\frac1{-Y^2}\implies X^2>\frac1{Y^2}\implies X^2Y^2>1\implies xy>1$

$(3)$ If $-\frac\pi2\le \arctan x+\arctan y\le \frac\pi2, \arctan x+\arctan y=\arctan\left(\frac{x+y}{1-xy}\right)$