Matrix equation with diagonal matrix
Because $A$ is symetric psd matrix, we can diagonalize $A$ as: $A = UDU^T$ where $U$ is a orthogonal matrix ($U^T = U^{-1}$) and $D$ is a diagonal matrix. Hence, we have \begin{align} (A+xI)^{-1} &= (UDU^T+xUU^T)^{-1} \\ &= (U(D+xI)U^{-1})^{-1} \\ &= U(D+xI)^{-1}U^{-1} \\ \end{align} Then \begin{align} a & =\theta^TA(A+xI)^{-1}(A+xI)^{-1}A\theta \\ & =\theta^TUDU^T \left(U(D+xI)^{-1}U^{-1}\right) \left(U(D+xI)^{-1}U^{-1}\right)UDU^T\theta \\ & =\theta^TUD \left((D+xI)^{-1}\right)^2DU^T\theta \\ \end{align}
The matrix $ \left((D+xI)^{-1}\right)^2$ is a diagonal matrix of $\frac{1}{(d_i+x)^2}$ with $(d_1,...,d_n)$ is the diagonal of the matrix $D$. Let's denote $\eta =(\eta_1,...,\eta_n) = DU^T\theta \in \mathbb{R}^n$, we have
$$a = \sum_{i=1}^n\frac{\eta_i^2 }{(d_i+x)^2}$$