Distribution of sums of random variables over finite field Let $q$ be an odd prime, $X_1, \ldots, X_n$ be i.i.d. random variables over $\mathbb Z_q$, and $0 < p < 1$ be some constant.  Let $X_i$ take on the value $0$ with probability $p$, and the remaining probability mass be distributed uniformly among the other $q - 1$ values, i.e.
$$
\begin{align*}
\Pr[X_i = 0] &= p \\
\Pr[X_i = j] &= \frac{1 - p}{q - 1}\text{ for }j \ne 0\text{.}
\end{align*}
$$
What can one say about the distribution of $\sum\nolimits_{i = 1}^{n} X_i \pmod q$?
I tried doing things inductively, but couldn't arrive at a pattern.
I can tell that there are $q + 1$ ways to obtain each number $k \in \mathbb Z_q$ in $X_1 + X_2$, so it shouldn't be too hard to argue that $\Pr[X_i = j]\text{ for }j \ne 0$ remains distributed uniformly among some probability mass, but what probability mass exactly gets left for them?
 A: We can first solve the easier problem of finding the probability $p_k$ that $k$ uniformly random non-zero elements of $\mathbb Z_q$ add up to $0$. This probability satisfies the recurrence
$$
p_{k+1}=\frac1{q-1}(1-p_k)
$$
with the initial value $p_0=1$, with solution
$$
p_k=\frac{1-(1-q)^{1-k}}q\;.
$$
You're adding $k$ non-zero elements with probability $\binom nk(1-p)^kp^{n-k}$, so the total probability to get $0$ is
\begin{align}
\sum_{k=0}^n\binom nk(1-p)^kp^{n-k}\cdot\frac{1-(1-q)^{1-k}}q
&=
\frac1q\left(1-(1-q)^{1-n}(1-p+p(1-q))^n\right)
\\
&=
\frac1q\left(1+(q-1)\left(\frac{pq-1}{q-1}\right)^n\right)\;,
\end{align}
and the remaining probability is distributed uniformly among the non-zero elements.
Alternatively, you could directly solve the recurrence
$$
a_{n+1}=pa_n+\frac{1-p}{q-1}(1-a_n)\;,
$$
which tracks the probability $a_n$ of having a zero sum after $n$ summands: With probability $p$ a zero summand is added to a zero sum, and with probability $\frac{1-p}{q-1}$ the right non-zero summand is added to a non-zero sum to make it zero.
