Suppose $X_n$ denotes the color of the $n$th card in the shuffled deck.
Then note that the last card always denotes the end of a run. Other ends of runs are characterized by $X_n\ne X_{n+1}$ which indicates a run ending at $n$.
Note that $P(X_n\ne X_{n+1})=26/51$ (since once you fix a card, you can choose another card from remaining 51 out of which 26 will have a different color).
So summing up the indicators $X_n\ne X_{n+1}$ we get the number of runs -
$$\#\text{runs}=1+\sum_{n=1}^{51}\mathbb{I}_{X_n\ne X_{n+1}}.$$
So $$E(\#\text{runs})=1+\sum_{n=1}^{51}P(X_n\ne X_{n+1})=1+\sum_{n=1}^{51}26/51=27.$$
Source