How to Find HalfAngle Identities for Tangent
The halfangle trig identity for tangent has two versions. Rather than this being a nuisance, having more than one option is really rather nice, because you can choose the version that works best for your situation. The halfangle formulas for the tangent involve both sine and cosine, but those functions switch places in the numerator and denominator of the fraction.
Sometimes the sine of a function doesn’t have a radical in its exact value when the cosine does (or vice versa). Depending on the sine and cosine values, you choose the version of the halfangle tangent identity that’ll be easiest to work with after you input the values. The math is easier when you don’t have to worry about those radicals in the denominator.
First, where do these halfangle tangent identities come from?

Use the ratio identity for tangent and fill in the halfangle identities for sine and cosine.
You can leave off the ± sign because you won’t have to choose which sign to use with the tangent identity — the squareroot sign squares out of the equation.

Put the numerator and denominator under the same radical and then simplify the complex fraction.

Multiply the numerator and denominator by the conjugate (same terms, different sign) of the denominator.

Replace the denominator by using the Pythagorean identity and then simplify by putting the radical over the numerator and denominator, individually.
To find the other form of this halfangle tangent identity, change Step 3 by multiplying the numerator and denominator of the fraction by the conjugate of the numerator instead of the denominator.