By definition, #a^2=a*a#. This is true for every number, in any set of numbers.
So we can expand #tan^2 x# as #tanx*tanx#.
As for a more general case, for any function #f(x)#, the #n#-th power of #f(x)# is usually denoted as
#f^n(x)#
for positive #n# only.
I'm saying "usually" because you might see in Calculus and anything related to derivatives in general the notation #f^n(x)# for the #n#-th derivative of #f(x)#.
However, the notation #f^((n))(x)# is far more popular when it comes to differentiating.
Another important thing to note is that
#f^(-1)(x)# is not #1"/"f(x)#. This is because #f^(-1)# represents the inverse function of #f#. Also because of this, you will probably never see #f^(-2)# being used.
This does apply here; #tan^-1 x != 1/tanx#. Rather,
#tan^-1x=arctanx#.