Yes, the RHS is a matrix, and that really only makes sense, as the LHS is a matrix, so they must be compatible.
You can easily see how to get to the formula by using block matrix multiplication.
Namely, you can write $U$ as a block matrix $U = \begin{bmatrix}u_1 & u_2 & \dots & u_D\end{bmatrix}$, where $u_i$ are column eigenvectors. Then $U^T = \begin{bmatrix}u_1^T \\ u_2^T \\ \vdots \\ u_D^T\end{bmatrix}$ and you do the multiplication:
\begin{align}
U\Lambda U^T&=\begin{bmatrix}u_1 & u_2 & \dots & u_D\end{bmatrix}
\begin{bmatrix}\lambda_1^{-1} & 0 & \dots & 0\\0 & \lambda_2^{-1} & \dots & 0\\ \vdots &\vdots & \ddots & \vdots\\ 0&0&0&\lambda_D^{-1} \end{bmatrix}
\begin{bmatrix}u_1^T \\ u_2^T \\ \vdots \\ u_D^T\end{bmatrix}\\
&= \begin{bmatrix}\lambda_1^{-1}u_1 & \lambda_2^{-1}u_2 & \dots & \lambda_D^{-1}u_D\end{bmatrix}\begin{bmatrix}u_1^T \\ u_2^T \\ \vdots \\ u_D^T\end{bmatrix}\\
&=\lambda_1^{-1}u_1u_1^T + \lambda_2^{-1}u_2u_2^T+\dots+\lambda_D^{-1}u_Du_D^T\\
&=\sum_{i=1}^D\frac1{\lambda_i}u_iu_i^T
\end{align}