Number of elements in a group of different orders, mod $n$, yields subgroup information? The alternating group on five elements, $A_5$, has $1$ element order $1$, $15$ elements order $2$, $20$ elements order $3$, and $24$ elements order $5$. If I take these numbers mod some $n$, sometimes I get numbers of elements which correspond to a subgroup of $A_5$. 
To clarify, an example with $n=10$.
$\{1,15,20,24\}$ mod $10$ becomes $\{1,5,0,4\}$. $D_{10}$, the dihedral group of order $10$, has one element order $1$, $5$ elements order $2$, and $4$ elements of order $5$. $D_{10}$ is also a subgroup of $A_5$. This also happens for the other $n$ equal to the order of some subgroup of $A_5$.
My question is, why does this happen? And what conditions are necessary for this to occur in other groups, since this doesn't occur for all groups.
 A: Let $\omega_d(G)$ be the number of elements of order d in the finite group G.  Let X be the collection of all finite groups G such that for every d, $\omega_d(H) = \omega_d(G) \mod |H|$ for every subgroup H ≤ G.
As jspecter's remarks, X is clearly closed under subgroups, so we may be interested in minimal non-X-groups, those groups which are not in X but every proper subgroup is in X.
Lemma: The cyclic group of order pq for distinct primes p, q is a minimal non-X-group.
Proof: It has p−1 elements of order p, but it cannot be the case that both p−1≡0 mod q and q−1≡0 mod p. $\square$
Lemma: A finite group with both a cyclic subgroup and an elementary abelian subgroup, both of order $p^2$, cannot be an X-group.
Proof: The number of elements of order p in the whole group must be equal to $p^2-1 \mod p^2$ due to the elementary abelian subgroup, but it must also be equal to $p-1 \mod p^2$ due to the cyclic subgroup. $\square$
Proposition: A finite abelian group is an X-group if and only if it is a cyclic p-group or an elementary abelian p-group for some prime p.
Proof: If the group is not a p-group, then the first lemma applies.  If the group is not of exponent p, then it must be cyclic by the second lemma. $\square$
Proposition: A finite 2-group is an X-group if and only if it is cyclic, elementary abelian, or the quaternion group of order 8.
Proof: If the group has exponent 2, then it is elementary abelian. Otherwise it contains an element of order 4.  By the second lemma it contains no elementary abelian subgroups of rank 2, and so it must be cyclic or generalized quaternion. However the generalized quaternion group of order 16 is a minimal non-X-group, and so the only possibility is Q8 which is easily checked to be an X-group, have 6 elements of order 4, which is 2 mod 4 and 0 mod 2. $\square$
The p-groups for odd p will defy such an explicit classification, since all groups of exponent p are X-groups. However, this is the only obstacle:
Proposition: A p-group for odd p is an X-group if and only if it is cyclic or of exponent p.
Proof: Again, unless it is exponent p it cannot have any elementary abelian subgroups of rank 2.  In the odd p case, this leaves only the cyclic groups as candidates. $\square$.
Proposition: A nilpotent group is an X-group if and only if it is a cyclic p-group, a group of exponent p, or the quaternion group Q8.
Proof: A nilpotent X-group must be a p-group lest it contain a cyclic subgroup of order pq. $\square$
I will leave solvable groups open for now, but remark with jspecter that non-abelian groups of order pq and more generally cyclic groups of order $p^n$ acting faithfully and irreducibly on groups of order $q^m$ are X-groups, as they have $(p^d-p^{d-1})q^m$ elements of order $p^d$ which is 0 mod $q^m$ as it should be, and since $1 \equiv q^m \mod p^n$ in order for the action to exist, it is even equal to $p^d - p^{d-1}$ mod $p^d$ as it should be. Similarly, $q^m-1$ is equal to 0 mod $p^n$ and $q^d-1$ mod $q^d$, all as it should be.
Proposition: A finite non-abelian simple group is an X-group if and only if it is PSL(2,4) or PSL(2,8).
Proof: We have several convenient hypotheses available: the Sylow 2-subgroups are elementary abelian (cyclic and quaternion being ruled out by Glauberman's Z*-theorem), and so the group is either a $\operatorname{PSL}(2,2^n)$ or J1.  Explicit calculation rules out J1, and confirms PSL(2,4) and PSL(2,8).  For general $2^n$, our group contains cyclic groups of order $2^n+1$ and $2^n-1$, both of which must be prime powers.  I believe the only solutions to this are $2^2\pm1=3,5$ and $2^3\pm1=7,9$, but I am not sure if this a well-known fact or an open problem in elementary number theory.
This can be extended to all almost simple groups by observing that S5 and PΓL(2,8) are not X-groups.  The direct product of almost simple groups is never an X-group, since it contains a cyclic subgroup of order $2p$.
