Assume that $Y\sim \mathcal{N}(0,I)$. I have one question about the proof which shows that $\mathbb{Var}(Y^TAY)=2\operatorname{tr}(A^2)$. I will not show the whole proof here, because it's quite long. Anyway, at the end of the proof we have
$\mathbb{E}(Y^TAY)^2=3\sum\limits_{i} a_{ii}^2+\sum\limits_{i}\sum\limits_{k\neq i} a_{ii}a_{kk}+\sum\limits_{i}\sum\limits_{j\neq i} a_{ij}^2+ \sum\limits_{i}\sum\limits_{j\neq i}a_{ij}a_{ji}$
If $A$ is symmetric, then $\operatorname{tr}(A^2)=\sum\limits_{i,j}a_{ij}^2$, so $$\mathbb{E}(Y^TAY)^2=(\operatorname{tr}(A))^2+2\operatorname{tr}(A^2).$$
I have two questions.
a) Why have they assumed that matrix $A$ is symmetric?
b) How have they obtained $\mathbb{E}(Y^TAY)^2=(\operatorname{tr}(A))^2+2\operatorname{tr}(A^2)$? I don't see here any connection with $\mathbb{E}(Y^TAY)^2=3\sum\limits_{i} a_{ii}^2+\sum\limits_{i}\sum\limits_{k\neq i} a_{ii}a_{kk}+\sum\limits_{i}\sum\limits_{j\neq i} a_{ij}^2+ \sum\limits_{i}\sum\limits_{j\neq i}a_{ij}a_{ji}$ (there should be).
Thanks in advance.
$\def\tr\operatorname{tr}$ For the first question I don't know the precise answer.
For your second question, $A$ is symmetric, so $a_{ij}=a_{ji}$ for all $i\ne j$. Let's calculate $\operatorname{tr}(A)^2$. $$ \operatorname{tr}(A)^2=(\sum_i a_{ii})^2=\sum_{i,k}a_{ii}a_{kk}=\sum_i a_{ii}^2+\sum_{i}\sum_{k\ne i}a_{ii} a_{kk}. $$ Next, we calculate $\operatorname{tr}(A^2)$ \begin{align} \operatorname{tr}(A^2)=\sum_i(A^2)_{ii}=\sum_{i,j} a_{ij}a_{ji}=\sum_{i,j} a_{ij}^2. \end{align} Now, it's easy to see that $$\mathbb{E}(Y^TAY)^2=(\operatorname{tr}(A))^2+2\operatorname{tr}(A^2).$$