Moments of a combinatorial ensemble of random variables Suppose $X_1,\dots,X_n$ are jointly distributed random variables such that the random $n$-tuple $(X_1,\dots,X_n)$ is uniformly distributed on the set of $n$-tuples of nonnegative integers summing to $k$. Clearly each $X_i$ has expected value $k/n$. Does the published literature provide nice formulas for the expected values of $p(X_1,X_2,\dots)$ for infinite classes of polynomials $p(\cdot,\cdot,\dots)$?
I am being necessarily vague about the form of $p$ because I’m sure that the ones I really want to understand aren’t in the literature (they appear rather unnatural when you write them out) but I’m hoping to express them in terms of more natural “building blocks” (perhaps monomials, perhaps something else) and I want to know which building blocks to use. Additionally, methods used to prove those results may give me ideas for how to attack my polynomials directly.
An example would be $p(x_1,x_2,x_3,\cdots) = (x_1+x_2+1)(x_1+x_2+2)$, but what I want to know is not the answer for this specific case but general methods that are suited to solving infinitely many problems of this kind at once. I don’t need someone to do the work for me, but I do want to use the right tools.
 A: The number of such tuples is the coefficient of $t^k$ in the product $$(1+t+t^2+\ldots)^n=(1-t)^{-n}=\sum_{k=0}^\infty \binom{-n}{k}(-t)^k= \sum_{k=0}^\infty \binom{n+k-1}{k}t^k.$$
The sum of $X_1^2$ over all such tuples is the coefficient of $t^k$ in the product $$(1^2\cdot t+2^2\cdot t^2+\ldots)(1+t+t^2+\ldots)^{n-1}=(t+t^2)(1-t)^{-n-2}= \\\sum_{k=1}^\infty \left(\binom{n+k}{k-1}+\binom{n+k-1}{k-2}\right)t^k.$$
Thus expectation of $X_1^2$ equals 
$$
\frac{\binom{n+k}{k-1}+\binom{n+k-1}{k-2}}{\binom{n+k-1}{k}}=
\frac{k (2 k + n - 1)}{n (n + 1)}.
$$
Expectation of $X_1X_2$ may be obtained analogously or using the fact that $$k^2/n=\mathbb{E} X_1(X_1+\ldots+X_n)=\mathbb{E} X_1^2+(n-1)\mathbb{E} X_1X_2,$$
thus $\mathbb{E} X_1X_2=\frac{k(k-1)}{n(n+1)}$.
A: (You are considering the uniform distribution on a discrete simplex. I'm not aware of specific results in the literature, 
and a brief internet search didn't reveal anything.)
A simple way is to use the joint (probability) generating
function of $X_1,\ldots,X_n$.
It is easy to see that it can be writen as
$$\mathbb{E}t_1^{X_1}\ldots t_n^{X_n}=\frac{1}{{n+k-1 \choose k}}[x^k] \prod_{i=1}^n \frac{1}{1-t_ix}$$
Using that one finds e.g. that for $j=(j_1,\ldots,j_n)$ and for  the polynomials $p_j(X_1,\ldots,X_n)={X_1 \choose j_1}{X_2 \choose j_2}\cdots {X_n \choose j_n}$
(product of binomial coefficients) and $s=j_1+\ldots+j_n$
$$\mathbb{E} p_j(X_1,\ldots,X_n)=\frac{{k \choose s }}{{n+s-1 \choose s}}$$
ADDED: the first appearance of moments seems to be in Whitworth, Choice and Chance. Withe 1000 exercises, 5th edition (1901),
exercise 945 (bottom of page 323). See https://archive.org/details/choicechancewith00whituoft/page/n4
