Trace of $A$ if $A =A^{-1}$
Let $t=\text{tr}(A)$. Since $A^2=I_2$, one knows that $\det(A)=\pm1$ and Cayley-Hamilton theorem yields $A^2-t\cdot A+\det(A)\cdot I_2=O_2$, that is, $$I_2-t\cdot A\pm I_2=O_2.$$ Thus $t\cdot A=O_2$ or $t\cdot A=2I_2$. Taking the trace again, this implies that $t^2=0$ or $t^2=4$.
Hence, $t=\text{tr}(A)$ is in $\{-2,0,+2\}$ and these three cases are realized, for example by the diagonal matrices $A=\begin{pmatrix}a & 0\\ 0& b\end{pmatrix}$ with $a$ and $b$ in $\{-1,+1\}$.
Edit: After this answer was posted, the OP added the condition that $A\ne I_2$ and $A\ne-I_2$. Then the unique solution is $\text{tr}(A)=0$ (proof left to the reader, entirely similar to the above).
From $A=A^{-1}$ you will know that all the possible eigenvalues are $\pm 1$, so the trace of $A$ would only be $0$ or $\pm 2$. You may show that all these three cases are realizable.
If ${\bf A} = {\bf A}^{-1}$ we may assume that $\det({\bf A}) \neq 0$. (Otherwise, what is ${\bf A}^{-1}$?) We can multiply the right-hand side of both sides of the equation by ${\bf A}$, giving:
$${\bf A} = {\bf A}^{-1} \iff {\bf A}{\bf A} = {\bf A}^{-1}{\bf A} \iff {\bf A}^2 = {\bf E} \, . $$ where ${\bf E}$ notes the $n \times n$ identity matrix. The characteristic polynomial of ${\bf A}$ is given by:
$$ \det({\bf A}-\lambda {\bf E}) = \det \left[ \begin{array}{cc} a_{11}-\lambda & a_{12} \\ a_{21} & a_{22}-\lambda \end{array} \right] =(a_{11}-\lambda)(a_{22}-\lambda)-a_{12}a_{21} $$ $$ =a_{11}a_{22} - \lambda a_{11} - \lambda a_{22} + \lambda^2 - a_{12}a_{21} = \lambda^2 - (a_{11} + a_{22})\lambda + (a_{11}a_{22} - a_{12}a_{21}) \, .$$ If $\text{tr}({\bf A})$ denotes the trace of ${\bf A}$, then $\det({\bf A}-\lambda {\bf E}) = \lambda^2 - \text{tr}({\bf A})\lambda + \det({\bf A}).$
We usually consider the eigenvalues, $\lambda$, given by $\det(A-\lambda E) = 0$. In other words, we usually consider the equation $\lambda^2 - \text{tr}({\bf A})\lambda + \det({\bf A}) = 0$. There is a great result due to Hamilton which says that if we replace the number $\lambda$ in the numerical equation $\det({\bf A}-\lambda {\bf E}) = 0$ by the matrix ${\bf A}$ then we get a matrix equation:
$$ {\bf A}^2 - \text{tr}(A){\bf A} + \det(A){\bf E} = {\bf 0} \, . $$
Next, we ask ourselves: what os $\det({\bf A})$? Well, since ${\bf A}^2 = {\bf E}$ it follows that $\det({\bf A}^2) = \det({\bf E})$ and, since $\det({\bf XY}) = \det({\bf X})\det({\bf Y})$, we have $\det({\bf A})^2 = \det({\bf E})$ which tells us $\det({\bf A})^2 = 1$. Clearly, $\det({\bf A}) = \pm 1$. Thence:
$${\bf A}^2 - \text{tr}(A){\bf A} \pm \det(A){\bf E} = {\bf 0} \implies {\bf E} - \text{tr}(A){\bf A} \pm {\bf E} = {\bf 0}\, .$$
At this point, we should separate into the $\pm$ cases:
$${\bf E} - \text{tr}(A){\bf A} - {\bf E} = {\bf 0} \ \ \text{or} \ \ {\bf E} - \text{tr}(A){\bf A} + {\bf E} = {\bf 0} \, . $$
In the first case, we get $\text{tr}(A){\bf A} = 0$. Since $\det({\bf A}) \neq 0$ it follows that $\text{tr}({\bf A}) = 0.$ In the second case, $-\text{tr}(A){\bf A} = -2{\bf E}$. This is only possible if ${\bf A} \propto {\bf E}$. For more detail, notice that:
$$-\text{tr}(A){\bf A} = -2{\bf E} \implies \text{tr}\left[-\text{tr}(A){\bf A}\right] = \text{tr}\left[-2{\bf E}\right] \implies \text{tr}(A)^2 = 4 \implies \text{tr}(A) = \pm 2.$$
It follows that the necessary conditions are that $\text{tr}(A) = -2, 0 , 2.$