Let $n > 0$ be a positive integer (large) and $p > 2$ a fixed prime number. What is the probability that $$\sum_{ 1 \leq i < j \leq n} a_ia_j = 0 \mod p$$ where $a_1, a_2, \dots a_n$ are chosen uniformly from the set $S = \{-1, 1\}$. Does this sum equidistribute mod $p$ as $n$ goes to infinity? What would be the speed of equidistribution in terms of $n$? Is there any literature in this type of random sums? I would be surprised if not but I am unable to find anything related or similar to this.
One can also ask what is the probability of this sum being actually zero, but I also have no idea how to deal with it and thought that modulo a prime would be simpler.
P.S. The previous questions is just a model for the more general type of sum I am interested, which is a bit more nasty to state and it is as follows: Fix $k \geq 1$, fix $S$ a set of integers and a prime number $p$. Let $(a_1, a_2, \dotsc, a_n)$, $(b_1, b_2, b_3, \dotsc, b_n)$ be two sequence of integers chosen uniformly from $S$. I would like to understand what is the probability that $$\sum_{i_1 < i_2 < \dotsb < i_k } a_{i_1}a_{i_2}\dots a_{i_k} = 0 \mod p$$ or the probability that $$\sum_{i_1 \leq j_1 < i_2 \leq j_2 < \dotsb < i_k \leq j_k} a_{i_1}b_{j_1}\dots a_{j_k}b_{j_k} = 0 \mod p$$. I am interested in the asymptotic probabilities in terms of $n$ and whether for different $k$'s this sums tend to be independent of each other for $n$ sufficiently large. I am also interested in this when $k$ varies depending on $n$.
Any suggestion, trick or vaguely related information related to this is highly appreciated.