For example, classify groups of order $4$.
Let $G=\{a,b,c,d\}$ be a group whose order is $4$.
$G$ must have an identity element $e$.
Without loss of generality, we can assume $d$ is the identity element of $G$.
So, $G=\{e,a,b,c\}$.
(1) Suppose that there is an element of $G$ whose order is $4$.
Without loss of generality, we can assume $o(a)=4$.
Then, $G=\{e,a,a^2,a^3\}$.
Without loss of generality, we can assume $b=a^2$ and $c=a^3$.
Since $e$ is the identity element of $G$, the Cayley Table for $G$ must be the following:
\begin{array}{c|cccc}
\cdot & e & a & b & c\\
\hline
e & e & a & b & c\\
a & a & \color{red}{?} & \color{red}{?} & \color{red}{?}\\
b & b & \color{red}{?} & \color{red}{?} & \color{red}{?}\\
c & c & \color{red}{?} & \color{red}{?} & \color{red}{?}
\end{array}
$a\cdot a=a^2=b$.
$a\cdot b=a\cdot a^2=a^3=c$.
$a\cdot c=a\cdot a^3=a^4=e$.
$b\cdot a=a^2\cdot a=a^3=c$.
$b\cdot b=a^2\cdot a^2=a^4=e$.
$b\cdot c=a^2\cdot a^3=a^5=a$.
$c\cdot a=a^3\cdot a=a^4=e$.
$c\cdot b=a^3\cdot a^2=a^5=a$.
$c\cdot c=a^3\cdot a^3=a^6=a^2=b$.
So, the Cayley Table for $G$ must be the following:
\begin{array}{c|cccc} \cdot & e & a & b & c\\ \hline e & e & a & b & c\\ a & a & b & c & e\\ b & b & c & e & a\\ c & c & e & a & b \end{array}
Conversely, if the Cayley Table for $(G,\cdot)$ is the above table, then we see that $(G,\cdot)$ is closed under $\cdot$ and $(G,\cdot)$ has the identity element and each element of $(G,\cdot)$ has its inverse.
The Cayley Table for $Z/4Z$ is the following:
\begin{array}{c|cccc}
+ & \overline{0} & \overline{1} & \overline{2} & \overline{3}\\
\hline
\overline{0} & \overline{0} & \overline{1} & \overline{2} & \overline{3}\\
\overline{1} & \overline{1} & \overline{2} & \overline{3} & \overline{0}\\
\overline{2} & \overline{2} & \overline{3} & \overline{0} & \overline{1}\\
\overline{3} & \overline{3} & \overline{0} & \overline{1} & \overline{2}
\end{array}
If we replace $+$ with $\cdot$ and if we replace $\overline{0}$ with $e$ and if we replace $\overline{1}$ with $a$ and if we replace $\overline{2}$ with $b$ and if we replace $\overline{3}$ with $c$, then we get the Cayley Table for $(G,\cdot)$ from the Cayley Table for $Z/4Z$.
And of course, the associativity law holds in $Z/4Z$.
So, the associativity law also holds in $(G,\cdot)$.
So, $(G,\cdot)$ is a group in this case.
Fortunately, we didn't need to check if the associativity law holds in $(G,\cdot)$.
(2) Suppose that there is no element of $G$ whose order is $4$.
Then, $o(a)=o(b)=o(c)=2$ must hold.
Since $e$ is the identity element of $G$, the Cayley Table for $G$ must be the following:
\begin{array}{c|cccc}
\cdot & e & a & b & c\\
\hline
e & e & a & b & c\\
a & a & \color{red}{?} & \color{red}{?} & \color{red}{?}\\
b & b & \color{red}{?} & \color{red}{?} & \color{red}{?}\\
c & c & \color{red}{?} & \color{red}{?} & \color{red}{?}
\end{array}
$a\cdot a=e$.
$b\cdot b=e$.
$c\cdot c=e$.
If $a\cdot b=e$, then $a\cdot a=a\cdot b$.
Since $G$ is a group, the left cancellation law holds in $G$.
So, $a=b$ must hold.
This is a contradiction.
If $a\cdot b=a$, then $a\cdot b=a=a\cdot e$.
Since $G$ is a group, the left cancellation law holds in $G$.
So, $b=e$ must hold.
This is a contradiction.
If $a\cdot b=b$, then $a\cdot b=b=e\cdot b$.
Since $G$ is a group, the right cancellation law holds in $G$.
So, $a=e$ must hold.
This is a contradiction.
So, if $G$ is a group, then $a\cdot b=c$ must hold.
Similarly, $b\cdot a=c$ must hold.
Similarly, $b\cdot c=a$ must hold.
Similarly, $c\cdot b=a$ must hold.
Similarly, $c\cdot a=b$ must hold.
Similarly, $a\cdot c=b$ must hold.
So, the Cayley Table for $G$ must be the following:
\begin{array}{c|cccc} \cdot & e & a & b & c\\ \hline e & e & a & b & c\\ a & a & e & c & b\\ b & b & c & e & a\\ c & c & b & a & e \end{array}
Conversely, if the Cayley Table for $(G,\cdot)$ is the above table, then we see that $(G,\cdot)$ is closed under $\cdot$ and $(G,\cdot)$ has the identity element and each element of $(G,\cdot)$ has its inverse.
Let $H:=\{(),(1\text{ }2)(3\text{ }4),(1\text{ }3)(2\text{ }4),(1\text{ }4)(2\text{ }3)\}$ be a subset of $S_4$.
Then, it is easy to check $H$ is a subgroup of $S_4$ and its Cayley Table is the following:
\begin{array}{c|cccc} \cdot & () & (1\text{ }2)(3\text{ }4) & (1\text{ }3)(2\text{ }4) & (1\text{ }4)(2\text{ }3)\\ \hline () & () & (1\text{ }2)(3\text{ }4) & (1\text{ }3)(2\text{ }4) & (1\text{ }4)(2\text{ }3)\\ (1\text{ }2)(3\text{ }4) & (1\text{ }2)(3\text{ }4) & () & (1\text{ }4)(2\text{ }3) & (1\text{ }3)(2\text{ }4)\\ (1\text{ }3)(2\text{ }4) & (1\text{ }3)(2\text{ }4) & (1\text{ }4)(2\text{ }3) & () & (1\text{ }2)(3\text{ }4)\\ (1\text{ }4)(2\text{ }3) & (1\text{ }4)(2\text{ }3) & (1\text{ }3)(2\text{ }4) & (1\text{ }2)(3\text{ }4) & () \end{array}
If we replace $()$ with $e$ and if we replace $(1\text{ }2)(3\text{ }4)$ with $a$ and if we replace $(1\text{ }3)(2\text{ }4)$ with $b$ and if we replace $(1\text{ }4)(2\text{ }3)$ with $c$, then we get the Cayley Table for $(G,\cdot)$ from the Cayley Table for $H$.
And of course, the associativity law holds in $H$ since the associativity law holds in $S_4$.
So, the associativity law also holds in $(G,\cdot)$.
So, $(G,\cdot)$ is a group in this case.
Fortunately, we didn't need to check if the associativity law holds in $(G,\cdot)$.
My question is the following:
When we classify groups of order $n$, can we always skip to check if the associativity law holds in $(G,\cdot)$ like the above case in which $n$ is $4$?
In general one has to check associativity as pointed out in the comment by @ancientmathematician. However, as you have managed to find, there are often quick ways to do this by spotting that the group is simply some well known group.
Moreover, no one is going to ask you to classify groups of order $n$ by completing a Cayley table for anything other than very small $n$. It's just not practicable. So you should always be able to sidestep the issue!
As an example consider the table referenced by @ancientmathematician. This table has order $5$ but the only group of order $5$ is the cyclic group which does not have an element $a$ of order $2$. So there's no need to check associativity - we know it cannot be associative