First we are going to deal with
$\rm{D}_{2n}$ where $n$ is an odd number.
Then $ \rm{D}_{2n} = \langle a,b \rangle$ where $a^2=1$ is the reflection and
$b^n$ is the rotation.
Claim if $n=2m+1$ then the conjugacy classes, are
the $\{ b^{i}, b^{-i} \}$ for $ 1 \leq i \leq m$ and
$\{a b^{k} | 0\leq k < n \}$.
$\\ \\$
We note that $\mathrm{{D}} _{2n}= \{a^{i}b^{j}| 0\leq i \leq 1 , 0 \leq j \leq n\}$.
Take $1 \leq l <m$ and $0\leq k <n$ an element which is only rotation $ b^l $, then we see that
$b^{k} b^l b^{- k}= b^l $
and
$ a b^{k}b^l ( a b^{k} )^{-1}= a b^{k}b^l b^{-k}a = b^{-l} $
which proves that the orbit of $ b^l$ is just $\{ b^l , b^{-l} \}$.
$\\ \\$
For the other type of conjugacy classes
again we do the same computation for an element
$ a$ then its orbit is $ \{a b^{k} | 0\leq k < n \}$
using the relation $ ab^{k}a= b^{-k} $
we get that
$b^k a b^{-k} =a b^{-2k} $
and because $\gcd(2,n) = 1$,
$<b^{-2k}>= <b>$
and by taking conjugation with
$a b^k$
we get
$a b^k a b^{-k} a =a b^{2k}$. Therefore we have prove
the orbit always stays in the elements of the form $a b^{p}$
and that it covers all the elements which completes the analysis for $n$ odd.
We get the conjugacy equation (and of course the identity element has orbit only itself)
$2 n=1 + \underbrace {2 +2+ \cdots +2} _{m \rm{\,times}} +n.$
For the even case the analysis is the same but we get some different type of orbits, which
is expected since the even dihedral has center whereas the odd does not. Take $n = 2 m $
for $b^{k}$ for $ 1 \leq k < m$
the same computation gives that the orbit of $b^{k}$
is the same namely $ \{ b^k , b^{-k}\}$. We have an inconsistency with $r^m$
because tihs element with the same computation we get it goes to $r^{-m}$
but $r^{-m} = r^{m}$
which proves it is only a one element orbit.
Now again when we try to find the orbit of
the reflection element $a$, again with the same computation as before
we take elements of the form $ a b^{2k}$ but since $\gcd(2, n) =2$,
$b^2$ has order $m$ and so its orbit take only the elements of the form
$a b^l$ where $l$ is even.
We are left with one more orbit namely $a b^{p} $ where $p$ is odd
and by doing again the same computation this is indeed the orbit of $a b$.
The class equation is now
$$ 2n = 1+1+ \underbrace {2 +2 +\cdots +2 }_{m-1 \rm{times}} +m +m.$$