Apparently:
$$ E[X^2] = 1^2 \cdot \frac{1}{6} + 2^2 \cdot \frac{1}{6} + 3^2\cdot\frac{1}{6}+4^2\cdot\frac{1}{6}+5^2\cdot\frac{1}{6}+6^2\cdot\frac{1}{6} $$
where $X$ is the result of a die roll.
How come this expansion?
Apparently:
$$ E[X^2] = 1^2 \cdot \frac{1}{6} + 2^2 \cdot \frac{1}{6} + 3^2\cdot\frac{1}{6}+4^2\cdot\frac{1}{6}+5^2\cdot\frac{1}{6}+6^2\cdot\frac{1}{6} $$
where $X$ is the result of a die roll.
How come this expansion?
There are various ways to justify it.
For example, it follows from the definition of expectation and the law of the unconscious statistician.
Or consider the case $Y=X^2$ and computing $E(Y)$.
Here's another way to compute $E[X^2]$.
If you know how to compute $E[X]$ and $Var(X)$ for a dice roll, then you can work out $E[X^2]$ using this equivalence of variance: $Var(X) = E[X^2] - (E[X])^2$.
While this is not a general answer (see @Glen_b), this equivalence comes in handy pretty often.