Let $G$ be a nonabelian group of order $p^{3},$ where $p$ is a prime. Show that $G$ has exactly $p^{2}+p-1$ distinct conjugacy classes.
$\newcommand{\Span}[1]{\left\langle #1 \right\rangle}$You might try this argument. If $a \in G \setminus Z(G)$, then $C_{G}(a) < G$, so $C_{G}(a)$ has order less than $p^{3}$. Now $\Span{Z(G), a}$ has order at least $p^{2}$, as $a \notin Z(G)$, and $\Span{Z(G), a} \le C_{G}(a)$.
The conjugacy classes are the orbits of the action of $G$ on itself by conjugation. Then, by the Burnside Lemma we have:
\begin{alignat}{1} |\mathcal{O}| &= \frac{1}{|G|}\sum_{g\in G}|\operatorname{Stab}(g)| \\ &= \frac{1}{|G|}\sum_{g\in G}|C_G(g)| \\ &= \frac{1}{|G|}\Bigl(\sum_{g\in Z(G)}|C_G(g)|+\sum_{g\in G\setminus Z(G)}|C_G(g)|\Bigr) \\ \tag 1 \end{alignat}
Now, $g \in Z(G) \Rightarrow C_G(g)=G \Rightarrow |C_G(g)|=|G|$, while $g \in G\setminus Z(G) \Rightarrow |C_G(g)|<|G|$; but, for nonabelian groups, $Z(G)$ is a proper subgroup of all the centralizers, which then for noncentral elements must all have order $p^2$. Therefore $(1)$ reads:
\begin{alignat}{1} |\mathcal{O}| &= \frac{1}{p^3}\Bigl(p p^3+(p^3-p)p^2\Bigr) \\ &= p+p^2-1 \tag 2 \end{alignat}
Because $\mathcal Z(G)\subset\mathcal C(a_i)\neq G$ we must have $p$ $|$ $|\mathcal C(a_i)|$ $|$ $p^3$. Therefore $|\mathcal C(a_i)|=p^2$. $$\therefore p^3=p+np$$ $$\therefore n=p^2-1$$