Deriving the law of reflection for a moving mirror in relativity
There are two inertial frames of reference involved; a "primed" frame in which the mirror is at rest, and an "unprimed" frame in which the mirror is moving in the direction opposite the mirror's surface normal. Label the coordinates such that the direction the mirror is moving in (i.e. the direction opposite the surface normal) is the $x$ and $x'$ direction, the other direction in the plane containing both the incident and reflected beams is the $y$ and $y'$ direction, and the direction that's unimportant to this problem is the $z$ and $z'$ direction.
In either frame, the components of an incident photon's three-velocity are given by the projections of the three-velocity onto the coordinate axes. I.e., the three-velocity of an incident photon, as measured in each of the two frames of reference, is
$$\mathbf{u}_i=\left(\begin{array}{c}c\cos\theta_i \\ c\sin\theta_i \\ 0\end{array}\right)$$
and
$$\mathbf{u}'_i=\left(\begin{array}{c}c\cos\theta'_i \\ c\sin\theta'_i \\ 0\end{array}\right)\ \ ,$$
where $\theta_i$ and $\theta'_i$ are the angle of incidence as measured in each of the two frames of reference, and $c$ of course is the speed of light.
The derivation in the question uses a version of the relativistic velocity addition formula, a proof of which can be found in the linked-to Wikipedia article. That formula states that if a primed frame is moving with speed $v$ in the $x$ direction as measured in an unprimed frame, speeds along the $x$ and $x'$ direction, as measured in each of the two frames, are related as
$$u_x=\frac{u'_x+v}{1+v u'_x/c^2}\ \ .$$
Plugging in the $x$ and $x'$ components of $\mathbf{u}_i$ and $\mathbf{u}'_i$ into the relativistic velocity addition equation, i.e. setting
$$u_x=c \cos\theta_i$$
and
$$u'_x = c \cos\theta'_i$$
gives
$$c \cos\theta_i=\frac{c \cos\theta'_i+v}{1+v c \cos\theta'_i/c^2}\ \ .$$
Dividing both sides of that equation by $c$ gives
$$\cos\theta_i=\frac{\cos\theta'_i+\beta}{1+\beta \cos\theta'_i}\ \ ,$$
where $\beta = v/c$.
We can perform a similar procedure with a reflected photon. The three-velocity of a reflected photon, as measured in each of the two frames of reference, is
$$\mathbf{u}_r=\left(\begin{array}{c}-c\cos\theta_r \\ c\sin\theta_r \\ 0\end{array}\right)$$
and
$$\mathbf{u}'_r=\left(\begin{array}{c}-c\cos\theta'_r \\ c\sin\theta'_r \\ 0\end{array}\right)\ \ ,$$
where $\theta_r$ and $\theta'_r$ are the angle of reflection as measured in each of the two frames of reference. In the case of the reflected photon, the values we plug in to the relativistic velocity addition formula are
$$u_x=-c \cos\theta_r$$
and
$$u'_x = -c \cos\theta'_r\ \ ,$$
giving
$$- c \cos\theta_r=\frac{-c \cos\theta'_r+v}{1+v (-c \cos\theta'_r)/c^2}\ \ .$$
Dividing both sides of that equation by $-c$ gives
$$\cos\theta_r=\frac{\cos\theta'_r-\beta}{1-\beta \cos\theta'_r}\ \ .$$
The above formulas for $\cos\theta_i$ and $\cos\theta_r$ are inconvenient for the purposes of comparing $\theta_i$ and $\theta_r$, largely due to $\theta'_i$ and $\theta'_r$ each appearing twice in the equations. We can arrive at simpler equations by using the tangent half-angle formula
$$\tan\left(\frac{\theta}{2}\right)=\sqrt{\frac{1-\cos\theta}{1+\cos\theta}}\ \ .$$
Applying the tangent half-angle formula to $\theta_i$ gives
$$ \begin{align} \tan\left(\frac{\theta_i}{2}\right)&=\sqrt{\frac{1-\cos\theta_i}{1+\cos\theta_i}}\\ &=\sqrt{\frac{1-\frac{\cos\theta'_i+\beta}{1+\beta \cos\theta'_i}}{1+\frac{\cos\theta'_i+\beta}{1+\beta \cos\theta'_i}}}\\ &=\sqrt{\frac{1+\beta \cos\theta'_i-(\cos\theta'_i+\beta)}{1+\beta \cos\theta'_i+\cos\theta'_i+\beta}}\\ &=\sqrt{\frac{(1-\beta)(1-\cos\theta'_i)}{(1+\beta)(1+\cos\theta'_i)}}\\ &=\sqrt{\frac{1-\beta}{1+\beta}}\sqrt{\frac{1-\cos\theta'_i}{1+\cos\theta'_i)}}\\ &=\sqrt{\frac{1-\beta}{1+\beta}}\tan\left(\frac{\theta'_i}{2}\right)\ \ . \end{align} $$
Applying the tangent half-angle formula to $\theta_r$ would proceed similarly, except that $\theta'_i$ is everywhere replaced by $\theta'_r$, and $\beta$ is everywhere replaced by $-\beta$. The result is thus
$$\tan\left(\frac{\theta_r}{2}\right)=\sqrt{\frac{1+\beta}{1-\beta}}\tan\left(\frac{\theta'_r}{2}\right)$$
or
$$\tan\left(\frac{\theta'_r}{2}\right)=\sqrt{\frac{1-\beta}{1+\beta}}\tan\left(\frac{\theta_r}{2}\right)\ \ .$$
But since the mirror isn't moving in the primed frame, the normal law of reflection is valid in the primed frame, $\theta'_i=\theta'_r$, and so we have
$$ \begin{align} \tan\left(\frac{\theta_i}{2}\right)&=\sqrt{\frac{1-\beta}{1+\beta}}\tan\left(\frac{\theta'_i}{2}\right)\\ &=\sqrt{\frac{1-\beta}{1+\beta}}\tan\left(\frac{\theta'_r}{2}\right)\\ &=\sqrt{\frac{1-\beta}{1+\beta}}\left(\sqrt{\frac{1-\beta}{1+\beta}}\tan\left(\frac{\theta_r}{2}\right)\right)\\ &=\left(\frac{1-\beta}{1+\beta}\right)\tan\left(\frac{\theta_r}{2}\right)\ \ , \end{align} $$
which was the result to be shown.
Note that for $0<\beta<1$,
$$0<\left(\frac{1-\beta}{1+\beta}\right)< 1\ \ ,$$
so
$$\tan\left(\frac{\theta_i}{2}\right)<\tan\left(\frac{\theta_r}{2}\right)$$
and $\theta_i<\theta_r$.
ADDENDUM:
As a response to the comments on this answer, the following provides additional clarification of the confusing statement in the question that "For the reflected ray changes $\theta$ before was $\theta_i $ is now $\theta =\pi-\theta_r $, similarly $\theta'= \pi- \theta'_r $ waves $ \cos \theta = - \cos (\theta_r)$":
For a three-velocity $\mathbf{u}$ in general, the $x$ component of $\mathbf{u}$, $u_x$, is given by the scalar projection of $\mathbf{u}$ onto $\hat{\mathbf{x}}$, the unit vector in the $x$ direction. As per the scalar projection Wikipedia article, the scalar projection can be expressed as
$$u_x=\left|\mathbf{u}\right|\cos\theta\ \ ,$$
where $\left|\mathbf{u}\right|$ is the length of $\mathbf{u}$, and $\theta$ is the angle between $\mathbf{u}$ and $\hat{\mathbf{x}}$.
The speed of either an incident or a reflected photon is $c$, i.e.,
$$\left|\mathbf{u}_i\right|=\left|\mathbf{u}_r\right|=c\ \ ,$$
so in either case we use $\left|\mathbf{u}\right|=c$ in the scalar projection equation for $u_x$.
The angle of incidence $\theta_i$ is defined as the angle between $-\mathbf{u}_i$ and $\hat{\mathbf{n}}$, where $\hat{\mathbf{n}}$ is the mirror surface's unit normal. But that angle is the same as the angle between $\mathbf{u}_i$ and $-\hat{\mathbf{n}}$, which is the same as the angle between $\mathbf{u}_i$ and $\hat{\mathbf{x}}$, since we've defined our coordinate system such that $\hat{\mathbf{x}}=-\hat{\mathbf{n}}$. Thus, when dealing with $\mathbf{u}_i$, we just use $\theta=\theta_i$ in the scalar projection equation for $u_x$, i.e.
$$u_x=\left|\mathbf{u}\right|\cos\theta=c\cos \theta_i\ \ ,$$
as in the original answer above.
On the other hand, the angle of reflection $\theta_r$ is defined as the angle between $\mathbf{u}_r$ and $\hat{\mathbf{n}}$. The angle between $\mathbf{u}_r$ and $\hat{\mathbf{x}}$ differs from $\theta_r$ by $\pi$ radians, because the angle between $\hat{\mathbf{n}}$ and $\hat{\mathbf{x}}$ is $\pi$ radians. Thus, when dealing with a reflected photon, we use $\theta=\pi-\theta_r$ instead of $\theta=\theta_i$ in the scalar projection equation for $u_x$,
$$u_x=\left|\mathbf{u}\right|\cos\theta=c\cos (\pi-\theta_r)=-c\cos\theta_r\ \ ,$$
as in the original answer.
The scalar projection equations for $u'_x$ are the same as the scalar projection equations for $u_x$, for the same reasons, except that they use $\theta'_i$ and $\theta'_r$ instead of $\theta_i$ and $\theta_r$.