As stated in the comments (1 2 3), the counting function is multiplicative, so only the prime power case needs to be addressed. Last year, I derived a somewhat concise formula for $\lvert R_k (p^m)\rvert$, where $R_k (p^m)$ is the set of $k$-th power residues (not necessarily coprime to the modulus) modulo $p^m$. It was recently accepted for publication: Counting general power residues. Here is the result, quoted from the paper:
Let $\epsilon$ be the parity function. So for integers $t$, $
\epsilon(t) = \begin{cases}
0 &\text{ if } 2\mid t\\
1 &\text{ if } 2\nmid t. \end{cases} $
Let $p$ be a prime, and $k\ge 2$ and $m\ge 1$ be integers. Let $r$ be
the remainder of $m$ upon division by $k$. Let \begin{align*}
\alpha &= \dfrac{p-1}{(k,p-1)},\\
\beta &= (\nu_p (k)+1)(1-\epsilon(k))(1-\epsilon(p))+\nu_p(k)\epsilon (p),\\
\gamma &=
\begin{cases}
k &\text{ if } k \mid m\\
r &\text{ if } k\nmid m.
\end{cases}. \end{align*} Then \begin{align*} \lvert R_k (p^m)\rvert &= \alpha \cdot \left(\dfrac{p^k}{p^{\beta +1}}\cdot
\dfrac{p^m-p^{\gamma}}{p^k-1}+
\left\lceil\dfrac{p^{\gamma}}{p^{\beta+1}}\right\rceil\right)+1\\ &=
\alpha \cdot \left\lceil\dfrac{1}{p^{\beta +1}}\cdot
\dfrac{p^{m+k}-p^{\gamma}}{p^k-1}\right\rceil+1. \end{align*}
(Note that the $\dfrac{p^k}{p^{\beta +1}}\cdot
\dfrac{p^m-p^{\gamma}}{p^k-1}$ term is necessarily an integer, so it
can be absorbed into the ceiling term
$\left\lceil\dfrac{p^{\gamma}}{p^{\beta+1}}\right\rceil$ as shown.)
Obviously the proof is what matters, but computational testing matched the results of the formulas in all cases tried.
References: My initial inspiration was a paper Counting squares in $\mathbb Z_n$ of Walter Stangl, who addressed the quadratic case. Also, my discussion with Arturo Magidin in Is there a known formula for the number of $k^{\text{th}}$ power residues modulo $2^n$? was helpful in the derivation. After submission to the first journal that I tried, a reviewer noted that similar formulas were mentioned by Maxim Korolev in On the average number of power residues modulo a composite number (DOI), who himself referred to a paper The Number of kth Power Residues Modulo m of Ji Chungang.
Note: Given the content of the above references, the originality of my minor contribution rests only on unifying the various cases by noticing their similarities, summing a series that the others left unclosed, and expanded elementary exposition. I am not surprised that I was able to publish it only after trying a couple of other more well-known journals first, but it was a little surprising that the arXiv rejected posting it.