Let $G$ be a group of order $12$. Show that if $Z(G)$ is non-trivial, then $G$ has a subgroup of order $6$.
By Cauchy's theorem, there are $a,b$ elements of $G$ of order $2,3$ and by action of conjugation, I know that $|G|=|Z(G)|+ \sum_{i=1}^{n}[G:C_{G}(g_i)]$, where $[g_i]$, $i=1,\dots,n$ are conjugacy classes with more than one element, but I can't find a way to show that there is a subgroup of order $6$.
Any suggestions?
For the nonabelian case you don't even need Cauchy, as the class equation suffices. If $Z(G)$ has order $2$, then$^\dagger$ the noncentral elements have centralizers of order $4$ or $6$, and there must be some of order $6$ as otherwise you couldn't "fill the gap" of $10(=12-2)$ with conjugacy classes of size $3(=12/4)$, only. If $Z(G)$ has order $3$, then$^\dagger$ the noncentral elements have centralizers of order $6$: as for your task, you'd be done, but note that all the noncentral conjugacy classes would have then size $2(=12/6)$, a contradiction because they cannot "fill the gap" of $9(=12-3)$; so, such a group doesn't exist. Finally, $Z(G)$ cannot have order $4$ or $6$, because$^\dagger$ $8\nmid 12$ and there's no divisor of $12$ strictly greater than $6$, respectively.
$^\dagger$For every noncentral element $x$, $Z(G)<C_G(x)<G$ (strictly).