Question: Let a finite $G$ act on itself by conjugation, and let $N$ be the number of conjugacy classes. Find a formula for $|\mathrm{Hom}\left(\mathbb{Z}^n, G\right)|$, denoting the set of group homomorphisms from $\mathbb{Z}^n$ into $G$.
Attempt:
For $n=2$, I got that
Burnside's Lemma implies that
$$ |G|\cdot N = \sum_{g\in G} |\mathrm{Fix}\left(g\right)| $$
where
$$
\begin{aligned}
\mathrm{Fix}\left(g\right) &= \{ h\in G\;|\;g\ast h = h \} \\
&= \{h\in G\;|\; ghg^{-1} = h \} \\
&= \{ h\in G\;|\; gh = hg \}
\end{aligned}
$$
Hence
$$ \sum_{g\in G} |\mathrm{Fix}\left(g\right)| = | \{ (g,h) \in G\times G\;|\;gh = hg\} | = |\mathrm{Hom}\left(\mathbb{Z}^2, G\right)| $$
My attempt (for $n=3$):
My guess is that $|\mathrm{Hom}\left(\mathbb{Z}^n, G\right)| = |G|\cdot N^{n-1}$ but I do not know how to prove this or if it's even correct for non-abelian groups $G$. My observation is that for abelian groups $N$ = $|G|$, and for non-abelian groups, $N<|G|$. Intuitively, I would think as $n$ grows large the permutations of objects in $G\times G\times...\times G$ ($n$ times) such that they can be mapped onto by any homomorphism from an abelian group grows faster as $G$ becomes "more abelian", because of the property of homomorphisms.
Construct the function $\Phi:\mathrm{Hom}\left(\mathbb{Z}^3, G\right)\rightarrow G\times G$ where
$$ \Phi\left(\gamma\right) = \left(\gamma\left(1,0,0\right), \gamma\left(0,1,0\right), \gamma\left(0,0,1\right)\right) $$
$\Phi$ uniquely describes all homomorphisms in the set that we want. We know that this is an injective function and the image consists of ordered triples that commute so:
$$ |\mathrm{Hom}\left(\mathbb{Z}^3, G\right)| = |\{ \left(a,b,c\right)\in G\times G\times G\;|\; ab = ba, ac = ca, bc = cb\}| $$
Now consider once again $\mathrm{Fix}\left(a\right)$ under the conjugacy action. Both $b$ and $c$ must be in that set, since $a$ commutes with both $b$ and $c$. But in general that doesn't mean $b$ and $c$ commute with each other, but we require that otherwise it can't be a homomorphism.
My first attempt was to find the size of $\mathrm{Fix}\left(a\right)$ first, and then find the size of $\mathrm{Fix}\left(a\right)\cap\mathrm{Fix}\left(b\right)$. But I did not know how to do this or how it relates to the number of conjugacy classes. Not really sure how to proceed after this nor whether this is the right track.
There is no formula for the number of such homomorphisms only in terms of $|G|$ and $N$, which the formulation of the question seems to suggest. There are two groups of order 32, both of which have $N = 11$, yet $|\mathrm{Hom}(\mathbb Z^3, G)|$ differs between the group: for one group it is 3200, while for the other it is 4544. (These are the smallest examples for $n = 3$ in terms of order; additionally, there are no counterexamples for $n = 4$ up to order 20.)
To be a bit more precise, $|\mathrm{Hom}(\mathbb Z^3, D_{32})| = 4544$. That the number of conjugacy classes of $D_{32}$ is 11 can be computed "by hand", see for example this SE answer. I don't immediately have an easy answer for why $|\mathrm{Hom}(\mathbb Z^3, D_{32})|$ should take the particular value that it does, but this strikes me as an approachable question.
The other group, let's call it $H$, is a bit more mysterious. GAP describes it as an iterated semidirect product $H = ((C_4 \times C_2) \rtimes C_2) \rtimes C_2$, but my GAP skills are not strong enough to investigate further. But indeed computations confirm that $|\mathrm{Hom}(\mathbb Z^3, H)| = 3200$. This group $H$ has index 6 in GAP's list of groups of order 32.