How many terms are there in a cyclic summation? I was wondering whether there is any formula that can calculate the number of terms in a cyclic sum:

If $i = 1, \ldots, n$, then for $\sum_{\text{cyc}}x_ix_j$, there are $\frac{n(n-1)}{2}$ terms in the summation.

For example

If $i = 4$, then there are $6$ terms, like,  $x_1x_2, x_1x_3, x_1x_4, x_2x_3, x_2x_4, x_3x_4.$  which equals to $ \frac{4\times3}{2} = 6$.

However, is there any formula that can calculate the cases like,

$i = 1, \ldots, n$,  $\sum_{\text{cyc}}x_ix_jx_k$


$i = 1, \ldots, n$,  $\sum_{\text{cyc}}x_ix_jx_kx_l$


You call the sums cyclic sums, but in fact they are symmetric sums. Not all textbooks distinguish clearly between the two, which is unfortunate, because the distinction is useful. I'll call them symmetric sums here. See below for an explanation of the difference.
The number of terms in the symmetric sum
$$\sum_{\text{sym}}x_1x_2\cdots x_d,$$
over the products of $d$ distinct variables out of $n$, is precisely $\binom{n}{d}$. After all, each term is obtained by choosing $d$ variables from the $n$ variables, and every choice of $d$ variables yields a term in the symmetric sum.
For more general symmetric sums of the form
$$\sum_{\text{sym}}x_1^{n_1}x_2^{n_2}\cdots x_d^{n_d},$$
the number of terms is a multinomial coefficient. If $d_k$ denotes the number of $k$-th powers in the product, then the number of terms is
$$\binom{n}{d_0,\ldots,d_n}=\frac{n!}{d_0!d_1!\cdots d_n!}.$$
Note that $d_0+d_1+\ldots+d_n=n$.

The difference between symmetric and cyclic sums is clearest with an example; if $n=4$ then
$$\sum_{\text{sym}}x_1x_2=\sum_{\sigma\in S_4}x_{\sigma(1)}x_{\sigma(2)}=x_1x_2+x_1x_3+x_1x_4+x_2x_3+x_2x_4+x_3x_4,$$
which is the sum over all permutations of the indices of $x_1x_2$. On the other hand
$$\sum_{\text{cyc}}x_1x_2=\sum_{\sigma\in C_4}x_{\sigma(1)}x_{\sigma(2)}=x_1x_2+x_2x_3+x_3x_4+x_4x_1,$$
which is the sum over all cyclic shifts of the indices.
