This problem must be simple, but it's driving me crazy
(Following the comments I edit) If I have for example the following sequence $\{1, -1, 1, -1, 1, -1, 1, -1\}$ and ask how many subsets of two elements add up to zero, it's easy, since the are four 1s and four -1s, the result is $4\cdot4=16$ pairs add up to zero.
But my question is How about all the subsets of 4 elements that add up to zero?...and 6 elements?...and in general for an arbitrary and finite sequence such that there is always the same number of 1s as -1s, how to calculate all the subsets that add up to zero? As said in comments in a sequence $a_1,\dots,a_{2n}$ where $a_i=(-1)^i.$ How many $I\subseteq \{1,2,\dots,2n\}$ such that $|I|=k$ and $\sum_{i\in I}a_i=0$
Your sequence has even length since it has the same number $n$ of $1$s as $0$s.
You know there are $n^2$ ways to find two element sets that sum to $0$.
There are $z = \binom{n}{2} = n(n-1)/2$ ways to choose two $1$s and the same number of ways to choose two $0$s so $z^2$ subsets of size $4$.
Can you finish?