Suppose you have $(a_0+a_1x+a_2x^2+...+a_nx^n)^k$, and you want to expand and find a formula for the coefficients $\beta_j$ such that $\beta_j$ is the coefficient of the $x^j$ term.
I understand that when the all coefficients $a_1, ..., a_n$ are equal to 1, you would get: $$\beta_j = \sum_{i=0}^{\lfloor\frac{j-n}{k}\rfloor}(-1)^i\binom{n}{i}\binom{j-ik-1}{n-1}$$
but how would you generalize this $\forall a_1, ..., a_n \in \mathbb{R}$?

As indicated by @GerryMyerson we can use the multinomial theorem to extract $[x^j]$, the coefficient of $x^j$ of the multinomial.