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(theta)#, we're asking for #tan(theta)=1# or #tan(theta)=-1#
You could either look for a table of known values to find which angles #theta# satisfy these requests, or you can remember that, by definition,
#tan(theta)=sin(theta)/cos(theta)#
So, #tan(theta)=1# leads to
#sin(theta)/cos(theta)=1 \iff sin(theta)=cos(theta)#
and the sine and cosine functions have the same value where #theta = 45°= pi/4# radians.
For the same reason, #tan(theta)=-1# leads to #sin(theta)=-cos(theta)#, which happens for #theta=-45°=-pi/8# radians. You can find this second solution remembering that the tangent is an odd function, i.e. #tan(-x)=-tan(x)#.