Is this a proof by contradiction? 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?
 A: 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: 

We know (as before) that $Z(G)$ is nontrivial. Let $h$ be any nonidentity element in the $Z(G)$. If $\langle h \rangle = G$ we are done. Otherwise, $|h| = p$. Then $\langle h \rangle$ is normal, since $h \in Z(G)$, and $|G / \langle h \rangle | = p$. Thus $G / \langle h\rangle$ is cyclic. Then, because $\langle h \rangle \subseteq Z(G)$, $G / Z(G)$ is a quotient group of $G / \langle h \rangle$, and so $G/Z(G)$ is cyclic. But that implies (by another theorem) that $G$ is abelian, as desired. 

In this proof, we did not assume $|Z(G)| = p$, so there is no direct contradiction. 
A: Actually the lemma is corallary of the following lemma;
Lemma: $H\leq Z(G)\leq K\leq G$ and $K/H$ is cyclic then $K$ is abelian. 
Corallary$1$: In particular, we can take $H=Z(G)$ and $K=G$ and we can say that if $G/Z(G)$ is cyclic then $G$ is abelian. 
Corallary$2$: By corallry $1$, $G/Z(G)$ is cyclic if and only if $G/Z(G)$ is trivial.
But many books does not mention lemma$1$ and corallray$2$, so the proof may seem to be strange. But if we use corallary$2$, we can say "proof by contradiction". But if we do not use it, it is still a valid way but I think it has no name,since the logic path like $(\neg R\to R)\to R$.
I also suggest you you to check;
Does $(\neg R\to R)\to R$ give rise to a proof strategy?
