Suppose that I have a polynomial of order $n$ $$ f_n(k)=\sum_{m=0}^n a_k k^m, $$ where $k$ is an integer and $a_k$ are arbitrary real numbers. Now I want to use Mathemtica to calculate $$ \sum_{k=1}^p f_n(k). $$ Mathematica does it pretty fast even for large $n$.
Q0. How does Mathematica calculate these sums? I'm asking mainly about how the engine processes it. I suppose it takes $k^m$ (one by one $m=0,\dots,n$) and uses some known (analytical) procedures for summing the partial sums over $k$.
Q1. What is the scaling as a function of $n$ for a fixed $p$ Mathematica achieves? Some experimenting shows that is must be polynomial in time.
Q2. Independently on Mathematica, what is the computational complexity of calculating such sums as a function of $n$ (for a fixed $p$)?
EDIT: The coefficients of $k^m$ in $f_n(k)$ are set to one but they are otherwise arbitrary real numbers so $f_n(k)$ can't be in general simplified.
EDIT: I added coefficients $a_k$ to the first sum to make the question more clear.
(n+1)*p
terms. $\endgroup$