I see from a comment under another answer that you're $16$ – so I'm guessing you may not have encountered generating functions yet – feel free to ask about anything in this answer!
The exponential generating function for the number $n!$ of permutations of $n$ objects is
$\sum_{n=0}^\infty n!\frac{x^n}{n!}=\sum_{n=0}^\infty x^n=\frac1{1-x}\;.$
This can be factored according to cycles as
$\prod_{k=1}^\infty\exp\left(\frac{x^k}k\right)=\exp\left(\sum_{k=1}^\infty\frac{x^k}k\right)=\exp(-\log(1-x))=\frac1{1-x}\;,$
where the $k$-th factor accounts for cycles of length $k$.
Now if the $m$-th power of a permutation is the identity, then the lengths of all its cycles must divide $m$. Thus the exponential generating function for the number of such permutations is
$\sum_{n=0}^\infty g_1(m,n)\frac{x^n}{n!}=\prod_{k\mid m}\exp\left(\frac{x^k}k\right)\;.$
To calculate a particular $g_1(m,n)$, you need to expand the right-hand side up to $x^n$.
If the $m$-th power of a permutation is $e_2$, consider first the case of even $n$. Then the permutation must consist of cycles of even lengths $2l$ such that $m$ is an odd multiple of $l$. The elements of $\{1,\dotsc,n\}$ must appear in pairs at opposite points of the cycles, which leads to a factor $\exp((2x)^l/(2l))$. Thus the exponential generating function for even $n=2j$ is
$\sum_{j=0}^\infty g_2(m,2j)\frac{x^j}{j!}=\prod_{{\scriptstyle l\mid m}\atop{\scriptstyle2l\nmid m}}\exp\left(\frac{(2x)^l}{2l}\right)\;.$
For odd $n=2j+1$, since $e_2$ maps $(n+1)/2$ to itself, the permutation also has to map $(n+1)/2$ to itself, so $g_2(m,2j+1)=g_2(m,2j)$.
Since you found $g_1(3,n)$ from the article in countinghaus' answer, I'll illustrate how to get those same numbers from the exponential generating function. For $m=3$, there are only two divisors, $k=1$ and $k=3$, so we have
$ \begin{align} \sum_{n=0}^\infty g_1(3,n)\frac{x^n}{n!} &=\mathrm e^x\mathrm e^{x^3/3}\\ &=(1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\dotso)(1+\frac{x^3}3+\frac{x^6}{3^2\cdot2!}+\frac{x^9}{3^3\cdot3!}+\dotso)\\ &=1+x+\frac{x^2}2+\frac{x^3}2+\frac{3 x^4}8+\frac{7 x^5}{40}+\frac{9 x^6}{80}+\frac{39 x^7}{560}+\frac{137 x^8}{4480}+\frac{641 x^9}{40320}+\dotso \end{align}$
(computation). Then multiplying each coefficient by $n!$ yields $g_1(3,n)=1,1,1,3,9,21,81,351,1233,5769$ for $n=1,\dotsc,9$.