How do you calculate a sum over a polynomial? I know that given a polynomial $p(i)$ of degree $d$, the sum $\sum_{i=0}^n p(i)$ would have a degree of $d + 1$. So for example
$$
\sum_{i=0}^n \left(2i^2 + 4\right) = \frac{2}{3}n^3+n^2+\frac{13}{3}n+4.
$$
I can't find how to do this the other way around. What I mean by this, is how can you, when given a polynomial, calculate the polynomial which sums to it?
For example, if we know that 
$$
\sum_{i=0}^{n} p(i) = 2n^3 + 4n^2 + 2,$$
how can we find the polynomial $p(i)$?

To rephrase, I believe the question is this: 
Suppose that polynomials $p$ and $q$ have the property that 
$$
\sum_{i=0}^n p(i) = q(n)
$$
If you're given $q$, how can you find $p$? 
First, this is a lovely question. I'd never really considered it, because we almost always study instead "if you know $p$, how do you find $q$?" 
To answer though, turns out to be fairly simple. Write the following:
\begin{align}
q(n-1) &= p(0) + p(1) + \ldots + p(n-1) \\
q(n) &= p(0) + p(1) + \ldots + p(n-1) + p(n) \\
 \end{align}
Now subtract the top from the bottom to get
\begin{align}
q(n) - q(n-1) &= p(n) 
 \end{align}
As an example, in your case if we knew 
$$
q(n) = 2n^3 + 4n^2 + 2
$$
we'd find that 
$$
p(n) = q(n) - q(n-1) = 2n^3 + 4n^2 + 2 - [2(n-1)^3 + 4(n-1)^2 + 2],
$$
which you simplifies to
$$
p(n) = 6n^2 +2n - 2.
$$
Let's do an example: we know that for $p(n) = n$, we have $q(n) = \frac{n(n+1)}{2}$. So suppose we were given just $q$. We'd compute
\begin{align}
q(n) - q(n-1) 
&= \frac{n(n+1)}{2} - \frac{(n-1)(n)}{2} \\
&= \frac{n^2 + n}{2} - \frac{n^2 - n}{2} \\
&= \frac{n^2 + n-(n^2 - n)}{2} \\
&= \frac{n^2 + n- n^2 + n}{2} \\
&= \frac{2n}{2} \\
&= n,
\end{align}
so that $p(n) = n$, as expected. 
Note: As written, I've assumed that $p$ and $q$ are both polynomials. But the solution shows that if $q$ is a polynomial, then $p$ must also be a polynomial, which is sort of pleasing. 
Post-comment remarks
As @Antonio Vargas points out, though, there's an interesting subtlety: 
I've given a correct answer to my revised question, which was "If there are polynomials $p$ and $q$ satisfying a certain equality, then how can one find $p$ given $q$." 
But suppose that there is no such polynomial $p$. My answer still computes an expression which $p$, if it existed, would have to match. But since no such $p$ exists, the computed expression has no value. 
Or maybe I should say that it has a limited value: you can take the polynomial $p$ and compute its sum using inductive techniques and see whether you get $q$. If so, that's great; if not, then there wasn't any answer in the first place. 
Fortunately, you can also do that "Does it really work" check much more simply. You just need to check the the $n = 0$ case: if 
$$
\sum_{i = 0}^0 p(i) = q(0)
$$
then all higher sums will work as well. And this check simplifies to just asking: is
$$
p(0) = q(0)?
$$
In our example, $p(0) = -2$, while $q(0) = +2$, so it doesn't work out. 
