By Cauchy's theorem for the group $G$ of order $2p$, $p$ prime, we have that there is an element $a\in G$ of order $p$. But then every element $a^{k}\,,\;k\in\{1,2,\ldots,p-1\}$ of the subgroup $\langle{a}\rangle$ has order $p$.
By Sylow's 3rd theorem we have that the number of the subgroups of $G$ of order $p$ is of the form $1+mp$, for some $m\in{\mathbb{N}}$. But then
$$({p-1})\,(1+mp)+1\leqslant 2p\quad\Rightarrow\quad m=0\,.$$ So, there is just one subgroup of order $p$, or, in other words, the only elements of $G$ of order $p$ are the (non-zero) elements of $\langle{a}\rangle$. The other $p$ elements of $G$ must have order either $2p$, either $2$.
- If $G$ has an element of order $2p$ then $G$ is cyclic.
- If $G$ has not an element of order $2p$, then $G$ has $p-1$ elements of order $p$ and $p$ elements of order $2$ (and of cource a zero element of order $1$).
Remains to show that the last case makes $G$ isomorphic to the dihedral group $${\cal{D}}_{2p}=\left\langle{\rho,\,\tau \ | \ \rho^{p}=\tau^2={\rm{id}}, \ \tau\rho\tau=\rho^{-1}}\right\rangle\,.$$
- For $p=2$, we have $G\cong {\cal{D}}_{4}$.
- For $p>2$, it is suffice to show that for the element $a$ -which is a generator of the subgroup $\langle{a}\rangle$- and for an element $b\in G$ of order $2$ holds $bab=a^{-1}$.
Because $\big[G:\langle{a}\rangle\big]=2$, the subgroup $\langle{a}\rangle$ is normal. So, $b^{-1}ab\in\langle{a}\rangle$, or equivalently, there exists $k\in\{2,3,\ldots,p-1\}$ such that $b^{-1}ab=a^k$ [The case $k=0$ leads to $p=1$ and the case $k=1$ leads to $p=2$] and because $b^{-1}=b$ we have:\begin{align*}
bab=a^k\quad \quad (1)\,.
\end{align*} But, then \begin{align*}
bab=a^k\quad&\Longrightarrow\quad(bab)^k=a^{k^2}\\
&\Longrightarrow\quad\mathop{\underbrace{babbab\ldots bab}}\limits_{k\, {\text{times}}}=a^{k^2}\\
&\Longrightarrow\quad ba^kb=a^{k^2}\\
&\stackrel{(1)}{\Longrightarrow}\quad bbabb=a^{k^2}\\
&\Longrightarrow\quad a=a^{k^2}\\
&\Longrightarrow\quad a^{k^2-1}=e\\
&\Longrightarrow\quad p\,|\,k^2-1=(k-1)(k+1)\\
&\stackrel{p \,{\text{prime}}}{=\!=\!\Longrightarrow}\quad p\,|\,k-1 \; \vee\; p\,|\,k+1\,.
\end{align*} If $p\,|\,k-1$, then \begin{align*}
k=np+1\quad&\stackrel{(1)}{\Longrightarrow}\quad bab=a^{np+1}\\
&\Longrightarrow\quad bab=(a^{p})^na=ea=a\\
&\Longrightarrow\quad ba=ab\\
&\stackrel{(2,p)=1}{=\!=\!\Longrightarrow}\quad \circ(ab)=2p.
\end{align*} Contradiction. So must $p\,|\,k+1$, or equivalently \begin{align*}
k=np-1\quad&\stackrel{(1)}{\Longrightarrow}\quad bab=a^{np-1}\\
&\Longrightarrow\quad bab=(a^{p})^na^{-1}=ea^{-1}=a^{-1}
\end{align*} and $G$ is isomorphic to the dihedral group ${\cal{D}}_{2p}$.