Counting isomorphism classes of elliptic curves with specific torsion Generally speaking, I am interested in counting the number of $\mathbb{F}_p$- isomorphism classes of elliptic curves containing a specific torsion subgroup, and I was wondering if there were any simple formulas for particular torsion subgroups.  Any information on this topic is appreciated.
More specifically, I would like to count the number of $\mathbb{F_p}$-isomorphism classes  of elliptic curves whose torsion subgroup contains $\mathbb{Z}/N \times \mathbb{Z}/N$, where $N$ is a small fixed integer, for instance one for which the modular curve $X(N)$ has genus 0.  
I know that if you fix a prime $p$, and fix an isogeny class of such curves over $\mathbb{F}_p$, then Schoof  (in "Nonsingular plane cubic curves over finite fields") has formulas which express the number of isomorphism classes of these curves in the given isogeny class in terms of class numbers of certain quadratic extensions of the rationals.  So, for example, summing these expressions over all possible isogeny classes is an answer to the question. However, I don't know of any easy way to compute this sum of class numbers, and it seems that such a sum could potentially be expressed more simply.
Also, Schoof's result holds for all $N$, and I thought it might be possible for smaller $N>1$'s that things simplified a bit.
Thanks for the help!
 A: To add to Aşağı Güzdək's nice answer, there is something you can do also when the genus is greater than zero which is also in some sense an exact formula. Namely, if $\Gamma$ is one of $\Gamma_0(N), \Gamma_1(N)$ or $\Gamma(N)$ [or probably some other congruence subgroups as well, but I am not familiar with this story], and $Y_\Gamma$ (resp. $X_\Gamma$) is the corresponding open (resp. compact) modular curve, then one has 
$$ |Y_\Gamma(\mathbf{F}_p)| = p+1-\mathrm{Tr}(\mathrm{Frob}_p|E_2(\Gamma))-\mathrm{Tr}(\mathrm{Frob}_p|S_2(\Gamma)),$$
where $E_k(\Gamma)$ (resp. $S_k(\Gamma)$) is the Galois representation attached to Eisenstein series (resp. cusp forms) of weight $k$ for $\Gamma$. The Galois representation $E_2(\Gamma)$ is given by the $\ell$-adic cohomology of $X^\infty_\Gamma = X_\Gamma \setminus Y_\Gamma$, hence the appearance of the number of cusps in the previous answer. In general one can for a given $\Gamma$ and p figure out which of the cusps are defined over what fields by looking explicitly at the modular interpretation of $X_\Gamma^\infty$ described in the paper by Deligne & Rapoport.
The trace of Frobenius on the space of cusp forms is the really interesting one. In many cases this can be computed for a given $\Gamma$ and $p$ by looking in tables like the Modular Forms Database of William Stein, or asking SAGE to spit them out for you (see e.g. http://www.sagemath.org/doc/reference/sage/modular/modform/cuspidal_submodule.html) -- for a prime p, the trace of $\mathrm{Frob_p}$ coincides with the trace of the Hecke operator $T_p$, which can be read off from the pth Fourier coefficients of a basis of normalized eigenforms for the space of cusp forms you are looking at. 
It seems the only built-in functionality in SAGE is for the groups $\Gamma_0(N)$ and $\Gamma_1(N)$. But perhaps one can still do something for small N, e.g. using that conjugation by the matrix with entries $(0,-1;N,0)$ takes $\Gamma(N)$ to $\Gamma_0(N^2) \cap \Gamma_1(N)$ -- this tells you how to get cusp forms for $\Gamma(N)$ both from $\Gamma_0(N^2)$ and $\Gamma_1(N)$, and by the genus formula for $\Gamma(N)$ you can tell if this has produced all of them.
A: $\newcommand\F{\mathbf{F}}$
$\newcommand\Z{\mathbf{Z}}$
$\newcommand\SL{\mathrm{SL}}$
Because of the existence of the Weil paring, 
elliptic curves with such a subgroup only exist when
$p \equiv 1 \mod \ N$. 
Let $S_N$ denote the set of elliptic curves over $\F_p$ such
that $E[N]$ is defined over $\F_p$.
It will be slightly easier to assume that $N \ge 3$. In this case,
$Y(N)$ is a fine moduli space, and an $\F_p$-point on $Y(N)$
corresponds to 
a pair $(E,\alpha:E[N] \simeq \Z/N\Z \times \Z/N  \Z)$ defined over
$\F_p$. Given an elliptic curve $E \in S_N$,
how many points does it contribute to $Y(N)$? For a curve $E$
whose automorphism group is $\Z/2\Z$, We see that out of
the $|\SL_2(\Z/N\Z)|$ possible choices of $\alpha$
(technical remark, we have fixed a Weil pairing so that $Y(N)$ is
connected), $(E,\alpha) \simeq (E,\alpha')$ only if $\alpha' = \alpha$
or $\alpha' = [-1] \alpha$. Thus
$E$ contributes $|\SL_2(\Z/N\Z)|/2$ points to $Y(N)(\F_p)$.
 In general, $E$ may have slightly more
automorphisms, and we deduce that (for $N \ge 3$):
$$|Y(N)(\F_p)| = |\SL_2(\Z/N\Z)| \sum_{E \in S_N}
\frac{1}{|\mathrm{Aut}(E)|}.$$
Note that the quantity on the right is very close to 
$|\SL_2(\Z/N\Z)| \cdot |S_N|/2$, one only has to worry about the
elliptic curves with $j = 0$ or $j = 1728$, and this can be done by hand
if one wants to cross all the i's and dot all the t's. 
Suppose that $X(N)$ has $c_N$ cusps and genus $g_N$ (there are some
explicit slightly unpleasant formulas for these numbers, which can
be found (for example) in Shimura's book. All the cusps
are defined over $\F_p$ (with $p \equiv 1 \mod N$) so by the
Riemann hypothesis for finite fields, 
$$|Y(N)(\F_p) - (1+p) + c_N| = |X(N)(\F_p) - (1+p)| \le
2 g_N \sqrt{p}.$$
If $g_N = 0$ (which only happens if $N \le 5$), this leads to an 
exact formula for $|S_N|$.
In general, at least for large $p$, we see that
$$|S_N| \sim \frac{2p}{|\SL_2(\Z/N \Z)|}.$$
To make this all completely explicit for $N = 3$ (for example),
one gets, presuming I have not made a horrible computational error which is quite possible:
$$S_3 = \begin{cases} (p+11)/12, & p \equiv 1 \mod \  12, \\\
(p+5)/12, & p \equiv 7 \mod \  12. \end{cases}$$
 (note that $p \equiv 1 \mod 3$):
Of course, "exact formulas" will only exist for $N \le 5$.
Some related and slightly more difficult counting problems are also
nicely explained by Lenstra here (See 1.10):
https://openaccess.leidenuniv.nl/bitstream/1887/3826/1/346_086.pdf
