Find number of $r$-element subset of $S$ satisfying a property Let $S= \{1,2,...,1990\}$. A $31$-element subset $A$ of $S$ is said to be good if the sum of all the elements of $A$ is divisible by $5$. Find the number of $31$-element subsets of $S$ which are good.
Answer to the question above is $\frac{1990 \choose 31}{5}$. I found the answer online saying that defining a function such that: Let $A_i$ be an arbitrary $31$-element subset of $S$. Let $k$ be the sum of $A_i$, let $m$ be the least positive residue of $k \pmod 5$, and subtract $m$ from each element of $A_i$. I couldn't understand how the function works here and why the answer is only one-fifth of the number of 31-subsets of the set.
I attempted similar tactic on a question made by myself, but the attempt is futile:
Let $S=\{1,2,3,4\}$. A $2$-element subset $A$ of $S$ is said to be good if the sum of all the elements of $A$ is divisible by $2$. Find the number of $2$-element subsets of $S$ which are good. The answer should be $2$, but if I use formula above, $\frac{4 \choose 2}{2}=3$ which is obviously wrong, since only $\{1,3\}$ and $\{2,4\}$ satisfy the requirement. The function defined in the previous question doesn't work here, can anyone please provide guidance? And some thorough explanation on the function defined, thanks.
Actually the difference between the main question and mine is the residue of "number of members in the subset" modulo n which main question is 5 , and in my question is 2 ! 
The residue must be 1 modulo n .

Although it is an old question, I have just come here because I have had the same problem as the authour.
Let $$A = \{a_1, a_2,\ldots,a_{31}\}$$ be a 31-element subset of $S$. The sum of its elements $a_1 + a_2 + \cdots + a_{31}$ can be represented as $5p + q$, where $p \in\mathbb N$ and $q\in\mathbb \{0, 1, 2, 3, 4\}$. When we subtract $q$ from each element of $A$, we have $$(a_1 - q) + (a_2 - q) + \cdots + (a_{31} - q) = 5p + q - 31q = 5p - 30q,$$ which is divisible by 5. By doing the opposite, i.e. adding $q$ to each element of the set $\{a_1 - q, a_2 - q,  \ldots, a_{31} - q\}$, we can see that such a mapping is a bijection.
Now, let $$B = \{b_1, b_2, \ldots, b_{31}\}$$ be a 31-element subset of $S$ such that $b_1 + b_2 + \cdots + b_{31}$ is divisible by 5. There exist 5 unique subsets of $S$, which can be made by adding a number from $\{0, 1, 2, 3, 4\}$ to each element of $B$ (in case of 0 it would be $B$ itself), which means that for any good subset of $S$ there are 4 subsets that do not have that property. Thus, the answer is $\frac 15\binom{1990}{31}$.
If we try to apply the same technique to a 2-element subset $A = \{a_1, a_2\}$ of set $S = \{1, 2, 3, 4\}$, given that the sum of the elements of a good subset now should be divisible by 2, we will fail because $$(a_1 - q) + (a_2 - q) = 2p + q - 2q = 2p - q$$ is not divisible by 2 when $q$ is 1.
