I'm am confused with the following:
Let $|\psi\rangle$ and $|\phi\rangle$ be two qubit state vectors, with Bloch vectors $\mathbf{n}$ and $\mathbf{m}$ , respectively. $$P_\psi = |\psi\rangle\langle\psi|\\ P_\phi = |\phi\rangle\langle\phi| $$
Then, $$ \begin{align} \text{Tr}(P_\psi P_\phi) &= \text{Tr}(|\psi\rangle\langle\psi| |\phi\rangle\langle\phi|) \\&= \text{Tr}(\langle\psi|\phi\rangle \langle\phi|\psi\rangle) \\&= | \langle\psi|\phi\rangle | ^2 \end{align} $$
I do not understand how one get's $\langle\psi|\phi\rangle \langle\phi|\psi\rangle$ from $|\psi\rangle\langle\psi| |\phi\rangle\langle\phi|$. It doesn't even seem to make sense to me since $\langle\psi|\phi\rangle \langle\phi|\psi\rangle$ is a scalar and $|\psi\rangle\langle\psi| |\phi\rangle\langle\phi|$ an operator.
Also, does it make sense to take the trace of a scalar? Is the trace of a scalar the scalar itself? If so, I understand that we would have $$ \begin{align} \text{Tr}(\langle\psi|\phi\rangle \langle\phi|\psi\rangle) &= \langle\psi|\phi\rangle \langle\phi|\psi\rangle \\&= \langle\psi|\phi\rangle (\langle\psi|\phi\rangle)^* \\&= | \langle\psi|\phi\rangle | ^2 \end{align} $$
$\newcommand{\ket}[1]{\lvert{#1}\rangle} \newcommand{\bra}[1]{\langle{#1}\rvert} \newcommand{\braket}[2]{\langle{#1}|{#2}\rangle} \DeclareMathOperator{tr}{tr}$Yes, the trace of a scalar is the scalar itself, but $P_\psi P_\phi$ is not a scalar. You have \begin{equation*} \tr(\ket{\psi}\bra{\psi}\ket{\phi}\bra{\phi})= \tr(\ket{\psi}\braket{\psi}{\phi}\bra{\phi})= \braket{\psi}{\phi}\tr(\ket{\psi}\bra{\phi}), \end{equation*} and I think that in the proof you provided they switched the positions of the bra and the ket within the trace, which is incorrect (they are not operators by themselves, and you cannot separate them). You can choose a basis for your Hilbert space that includes $\ket{\psi}$, $\ket{\phi}$ and some other vectors $\ket{i}$: then \begin{equation*} \begin{split} \tr(\ket{\psi}\bra{\phi})&= \braket{\psi}{\psi}\braket{\phi}{\psi}+ \braket{\phi}{\psi}\braket{\phi}{\phi}+ \sum_i\braket{i}{\psi}\braket{\phi}{i}=\\&= \braket{\phi}{\psi}+ \braket{\phi}{\psi}+ \sum_i\braket{i}{\psi}\braket{\phi}{i}=\\&= 2\braket{\phi}{\psi}+ \sum_i\braket{i}{\psi}\braket{\phi}{i}, \end{split} \end{equation*} assuming that $\ket{\phi}$ and $\ket{\psi}$ are normalised to 1. Now, the trace is independent of the basis, so we can choose the $\ket{i}$ as we see fit: if we take them all orthogonal to the subspace spanned by $\ket{\phi}$ and $\ket{\psi}$, the previous expression reduces to \begin{equation*} \tr(\ket{\psi}\bra{\phi})=2\braket{\phi}{\psi}. \end{equation*} Therefore \begin{equation*} \tr(\ket{\psi}\bra{\psi}\ket{\phi}\bra{\phi})= \braket{\psi}{\phi}\cdot 2\braket{\phi}{\psi}= 2\lvert\braket{\psi}{\phi}\rvert^2. \end{equation*}