Let $G$ be a graph of diameter $n$ and $\theta_0,\theta_1,\ldots,\theta_n$ the distinct eigenvalues of the adjacency matrix of $G$. The following was defined as the primitive idempotents of $A$ (the adjacency matrix of $G$): For $0\leq i\leq d$, $$E_i=\prod_{j\neq i}\frac{A-\theta_j I}{\theta_i-\theta_j}$$.
What is the motivation for defining the $E_i$'s in this manner?
This isn't graph theory but linear algebra: the $E_i$ are the projections onto the eigenspaces of $A$ (which I assume is the adjacency matrix). You can prove this by looking at what each $E_i$ does to the eigenvectors of $A$; the argument is essentially the same observation that powers Lagrange interpolation.