Below is a proof that any group of order $p^2$ is abelian $(p$ prime of course).
Let $Z \left({G}\right)$ be the center of $G$. We know $|Z(G)|>1$. $\color{blue}{\text{Suppose}} \left\vert{Z \left({G}\right)}\right\vert = p$.
Then $|G/ Z(G)|=p\Rightarrow G/Z(G)$ is cyclic. It is not hard to then show that $G$ is abelian, $\color{blue}{\text{therefore}}$ $Z(G)=p^2$. This is a contradiction.
I fully understand the proof, but the logic seems strange to me; mainly, I can't decide whether this is an actual proof by contradiction or whether it is disguised as one. What is actually happening here, in terms of logic?
The proof as written is a proof by contradiction. Logically, the proof is fundamentally a proof by cases: because $Z(G)$ is a subgroup, we have that $|Z(G)|$ is $1$, $p$, or $p^2$. The case $|Z(G)| = 1$ is eliminated by a separate result, and $|Z(G)| = p^2$ is the desired result, so the proof proceeds by contradiction: assume $|Z(G)| = p$ (which is what we don't want to happen) and derive a contradiction.
This is not to say that every proof of this result must proceed by contradiction. At the cost of using some slightly more advanced facts, it is possible to write a proof that is not (directly) a proof by contradiction:
In this proof, we did not assume $|Z(G)| = p$, so there is no direct contradiction.