How was the plus-minus sign removed in these steps for proving a half-angle identity for tangent? How was the plus-minus sign removed in the following solution? (see red rectangle)


The derivation is indeed faulty. You can make it rigorous by avoiding the square roots:
\begin{align}
\tan^2\frac{\theta}{2}
&=\frac{1-\cos\theta}{1+\cos\theta} \\[6px]
&=\frac{1-\cos^2\theta}{(1+\cos\theta)^2} \\[6px]
&=\frac{\sin^2\theta}{(1+\cos\theta)^2}
\end{align}
Therefore we have
$$
\Bigl\lvert\tan\frac{\theta}{2}\Bigr\rvert=\frac{\lvert\sin\theta\rvert}{1+\cos\theta}
$$
(note that $1+\cos\theta>0$, so no absolute value is needed in the denominator) and now we can observe that $\tan(\theta/2)$ and $\sin\theta$ have the same sign for every $\theta$ and so the absolute values can be removed.
In a different way:
$$
\frac{\sin2\alpha}{1+\cos2\alpha}=\frac{2\sin\alpha\cos\alpha}{1+2\cos^2\alpha-1}=\frac{\sin\alpha}{\cos\alpha}=\tan\alpha
$$
Now set $\alpha=\theta/2$.
