Classify groups of order 27
As suggested in comments Conrad has a more thorough explanation. I will give you a short version without semidirect products.
First, we got $C_{27}$ and $C_9\times C_3$ and $C_3^3$. That's $3$ down.
So, now we let $G$ be a nonabelian group of order $27$. It's a $p$-group so it has a nontrivial center, thus the order of the center is either $3$ or $9$. However any group for which $G/Z(G)$ is cyclic is necessarily abelian (why?) so $Z(G)\cong C_3$. Hence $|G/Z(G)|=3^2$. Groups of prime square order are abelian, and again we don't want $G/Z(G)$ to be cyclic, so $G/Z(G)\cong C_3\times C_3$. Since $G/Z(G)$ is abelian, $G'\leqslant Z(G)$, and since $G$ is nonabelian $G'\not= 1$, whence $G'=Z(G)$.
Here we pause briefly to note that since $G$ is not cyclic, we must have $|G/\Phi(G)|=p^2$, so $G$ must have two generators with a nontrivial commutator, either both of order $3$ or one of order $3$ and the other of order $9$. So we've already got a pretty good idea of what the presentation is going to look like - we just need to fill in the details.
Now take $a,b\in G$ such that $aZ(G),bZ(G)$ generate $G/Z(G)$. Then $1\not= [a,b]$ generates $Z(G)$ (why?) so $a,b$ generate $G$. If $a,b$ both have order $3$, we have the presentation $\langle a,b\mid a^3,b^3,[a,b]=[a,b]^a=[a,b]^b\rangle$. (This is the presentation for $U(3,3)$, the Heisenburg group of order $27$.) If one of them has order $9$, let's say it's $a$ w.l.o.g., then $a^3$ generates $Z(G)$. In particular $a^3=[a,b]$ or $[a,b]^2$; either way we have $$\langle a,b|a^9,b^3,a^3=[a,b]\rangle\cong\langle a,b|a^9,b^3,b^a=ba^3\rangle.$$ This is $(C_3\times C_3)\rtimes C_3$. Note that if we had both $a$ and $b$ of order $9$, the presentation would be $\langle a,b | a^9,b^9,a^3=[a,b],b^3=[a,b]^2\rangle$ or $\langle a,b | a^9,b^9,a^3=[a,b],b^3=[a,b]\rangle$, which are again isomorphic to the above presentation.
Alexander's answer is excellent, but I wanted to come at this from a slightly different point of view, avoiding presentations.
Let $G$ be a group of order $27$. Now $G$ has a subgroup of order $9$, let's call it $H$; note that $H$ is normal in $G$.
First, assume that there is a $g\in G-H$ with $g^3=1$. Then, things are easy: $G$ is the semidirect product $H\rtimes\langle g\rangle$. Now there are two isomorphism choices for the order $9$ group $H$, and $g$ can act trivially or non-trivially, so that makes $4$ total possible groups for $G$. [I am glossing over some facts, most notably that $C_3\times C_3$ is completely reducible.]
Now assume that there are no order $3$ elements in $G-H$; I want to show $G$ is cyclic. We can assume that replacing $H$ with any other maximal subgroup doesn't put us in the context of the previous paragraph. If $[G:Z(G)]\le3$, then we will be done, so we can assume that $[G:Z(G)]=9$, and reach a contradiction. Note that $[G:Z(G)]=9$ means two things right away: $G/Z(G)$ is abelian, so $G'=Z(G)$, and $|Z(G)|=3$, so $Z(G)\subset H$. The map $f:\ G\rightarrow G$, given by $f(g)=g^3$, is actually a homomorphism:
$$ \begin{align*} x^3y^3&= x(yx)[x,y](yx)[x,y]^2y\\ &= (xy)^3[x,y]^3\\ &= (xy)^3. \end{align*}$$
The second equality follows from $G'\subset Z(G)$, and the third from $|Z(G)|=3$.
Assuming $G$ is non-cyclic, every element $g\in G-H$ has order $9$. Thus $g^3\in H$ is centralized by both $g$ and $H$, so $g^3\in Z(G)$. This also allows us to assume that $H$ is cyclic (why?). Thus, we must have $f(G)\subset Z(G)$. Then $\ker(f)$ has order at least $[G:Z(G)]=9$. But $\ker(f)=\lbrace g\in G\mid g^3=1\rbrace$ is a subset of $Z(G)$, which has order $3$; this is our contradiction.
The same argument above, with $3$ replaced by any odd prime $p$, gives the same classification of the five groups of order $p^3$.
Finally, let me mention that the step where we showed $G$ is cyclic generalizes quite a bit for odd primes $p$; namely, any finite $p$-group with a unique subgroup of order $p$ is cyclic. The proof follows from the homomorphism $f$, some counting $\pmod{p}$, and induction.