If you want a certain quantity to equal 1 when squared, then your quantity must be either 1 or −1. Every other number would not equal 1 when squared.
Since our quantity is tan(θ), we're asking for tan(θ)=1 or tan(θ)=−1
You could either look for a table of known values to
tan(θ)=sin(θ)cos(θ)
So tan(θ)=1 leads to
sin(θ)cos(θ)=1⇔sin(θ)=cos(θ)
and the sine and cosine functions have the same value where θ=45∘=π4 radians.
For the same reason. tan(θ)=−1 leads to sin(θ)=−cos(θ) which happens for θ=−45∘ radians. You can find this second solution remembering that the tangent is an odd function, i.e. tan(−x)=−tan(x)