<s>[INST] How to get formula for sums of powers? Assuming I have Bernoulli numbers:
$B = [\frac{1}{1},\frac{1}{2},\frac{1}{6},\frac{0}{1},-\frac{1}{30}, \frac{0}{1}, \frac{1}{42}, ...]$
How can I get the coefficients of the sums of powers formulas?
For example the sum of squares is $(1/3)n^3 + (1/2)n^2 + 1/6n$
 [/INST] What you're looking for is Faulhaber's formula (Wikipedia link):
$$\sum_{k=1}^n k^p = {1 \over p+1} \sum_{j=0}^p (-1)^j{p+1 \choose j} B_j n^{p+1-j},\qquad \mbox{where}~B_1 = -\frac{1}{2}$$
expressing the sum of the first $n$ $p$th powers as a polynomial in $n$ whose coefficients involve the Bernoulli numbers and some binomial coefficients.
To get the example you listed,
$$\begin{align*}
\sum_{k=1}^nk^2&=\frac{1}{3}\sum_{j=0}^2(-1)^j\binom{3}{j}B_jn^{3-j}\\\\
&=\left(\frac{1}{3}(-1)^0\binom{3}{0}B_0\right)n^3+\left(\frac{1}{3}(-1)^1\binom{3}{1}B_1\right)n^2+\left(\frac{1}{3}(-1)^2\binom{3}{2}B_2\right)n\\\\
&=\left(\frac{1}{3}\cdot 1\cdot 1\cdot 1\right)n^3+\left(\frac{1}{3}\cdot (-1)\cdot 3\cdot \left(-\frac{1}{2}\right)\right)n^2+\left(\frac{1}{3}\cdot 1\cdot 3\cdot \frac{1}{6}\right)n\\\\
&=\left(\frac{1}{3}\right)n^3+\left(\frac{1}{2}\right)n^2+\left(\frac{1}{6}\right)n
\end{align*}$$
</s>