This is a fairly standard result in the theory of diagonalizable linear operators, sometimes known as the spectral decomposition theorem for diagonalizable operators. Indeed, a linear operator over some field is diagonalizable if and only if it has a decomposition of this form. You can read about this in Hoffman & Kunze's "Linear Algebra" (specifically, the chapter "invariant sum decompositions"). The following theorem (quoted from the book) sums most of it up:

> Let $T$ be a linear operator on a
> finite-dimensional space $V$. If $T$
> is diagonalizable and if
> $c_1,\dots,c_k$ are the distinct
> eigenvalues of $T$, then there exist
> linear operators $E_1,\dots,E_k$ on
> $V$ such that:
> 
> 1. $T = c_1 E_1 + \cdots + c_k E_k$
> 2. $I = E_1 + \cdots + E_k$
> 3. $E_i E_j = 0$ if $i \ne j$.
> 4. $E_i ^2 = E_i$ for all $i$.
> 5. The image of $E_i$ is the space of $T$-eigenvectors with eigenvalue
> $c_i$.
> 
> Conversely,if there exist $k$ distinct
> scalars $c_1,\dots,c_k$ and $k$
> non-zero linear operators
> $E_1,\dots,E_k$ which satisfy
> conditions 1,2,3, then $T$ is
> diagonalizable, $c_1,\dots,c_k$ are
> the distinct eigenvalues of $T$ and
> conditions 4,5 are satisfied also.

Note that given such a decomposition for $T$, we have $f(T) = \sum f(c_i) E_i$ for any polynomial $f$ over the field. Fix some $1 \le i \le k$ and consider the polynomial $f (x) = \prod_{j \ne i} \frac{x - c_j}{c_i - c_j}$. This polynomial satisfies $f(c_r) = \delta_{r,i}$ and thus $f(T) = E_i$. So the projections $E_i$ are necessarily of the form you found.

By standard theory, $T$ is diagonalizable if and only if its minimal polynomial factors into distinct linear factors. Now, one may ask what kind of decomposition we can get if the minimal polynomial of $T$ factors into linear factors, not necessarily distinct. In this case, one can still form the sum $c_1 E_1 + \cdots + c_k E_k$ (where the $E_i$ are defined either by your formula or by property 5 above), but it won't be equal to $T$. Rather, it will differ from $T$ by a nilpotent operator (an operator $N$ with $N^m = 0$  for some integer $m$). More generally, a linear operator on a fin. dimensional vector space, over an algebraically closed field, can be written uniquely as the sum of a diagonalizable operator (called its diagonalizable part) and a nilpotent operator (called its nilpotent part) which commute with with one another. In this case $c_1 E_1 + \cdots + c_k E_k$ gives the diagonalizable part of $T$.

If the field is not algebraically closed then one may not be able to form the sum $c_1 E_1 + \cdots + c_k E_k$ at all, since some of the eigenvalues of $T$ may not be in the field. Nevertheless, there is still an analogous decomposition for $T$ in this case (at least when the field has characteristic zero, I guess), which represents $T$ (uniquely) as the sum of a "semisimple" operator and a nilpotent operator which commute with one another. Here "semisimple" is a property of operators which is equivalent to being diagonalizable if the field is algebraically closed, but is otherwise more involved.