It is shown in section $1.3$ of ug level book on Group Theory by Louis W. Shapiro, a way to build up the possible multiplication tables for groups of order $4$.
I know three properties only, as stated below (also, the reason other posts are unhelpful):
1. In abelian groups, if $ab=c$, then $ba =c$. This implies that their group tables must be symmetrical about the diagonal.
2. If take $ab=a$, then $b=e$; which is wrong.
3. In a group table, it is not possible to have $ab=ac=d$, as it implies $b=c$. Similarly, not possible to have $ba = ca = d$.
The book states two cases based on the choice of $ab = e$, or $ab = c$.
Case I: $ab = e$
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} & e&a&b&c \\ \textbf{a} &a&&& \\ \textbf{b} &b&&&\\ \textbf{c}&c&&&\end{array}\right]$$
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} & e&a&b&c \\ \textbf{a} &a&&e& \\ \textbf{b} &b&&&\\ \textbf{c}&c&&&\end{array}\right]$$
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} &e &a&b&c \\ \textbf{a} &a&c&e&b \\ \textbf{b} &b&&&\\ \textbf{c}&c&&&\end{array}\right]$$
$$Case \ I :\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} &e &a&b&c \\ \textbf{a} &a&c&e&b \\ \textbf{b} &b&e&c&a\\ \textbf{c}&c&b&a&e\end{array}\right]$$
Doubt -1: This is an abelian group, as per the property (#$1$) stated above.
The abelian property of the group is corroborated in the book, as shown in the image below.
But, the diagonal elements in the group table are not identity elements.
Also, no swap of rows / columns can achieve the diagonal elements being identity here.
Case II: $ab = c$
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} & e &a &b&c \\ \textbf{a} &a&&c& \\ \textbf{b} &b&&&\\ \textbf{c}&c&&&\end{array}\right]$$
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} & e &a &b&c \\ \textbf{a} &a&&c&b \\ \textbf{b} &b&&&\\ \textbf{c}&c&&&\end{array}\right]$$
$$Case \ II \ (a) :\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} & e &a &b&c \\ \textbf{a} &a&e&c&b \\ \textbf{b} &b&c&e&a\\ \textbf{c}&c&b&a&e\end{array}\right]$$
Doubt -2:
Book states (in table - Case II(a)) only one choice for $ac=b$, but it is not clear why $ac =e$ could not be a choice.
So, select the option $ac=e$ instead to see what changes it brings:
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} & e &a &b&c \\ \textbf{a} &a&&c&e \\ \textbf{b} &b&&&\\ \textbf{c}&c&&&\end{array}\right]$$
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} & e &a &b&c \\ \textbf{a} &a&b&c&e \\ \textbf{b} &b&&&\\ \textbf{c}&c&&&\end{array}\right]$$
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} & e &a &b&c \\ \textbf{a} &a&b&c&e \\ \textbf{b} &b&c&&\\ \textbf{c}&c&e&&\end{array}\right]$$
$$Case \ II \ (b) :\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} & e &a &b&c \\ \textbf{a} &a&b&c&e \\ \textbf{b} &b&c&e&a\\ \textbf{c}&c&e&a&b\end{array}\right]$$
Doubt -3:
Case II (c) : It is stated in the book, for Case II, that had we chosen $bc=e$, then would have reverted back to case I.
I want to ask, how does it become case I.
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} & e &a &b&c \\ \textbf{a} &a&e&c&b \\ \textbf{b} &b&&&e\\ \textbf{c}&c&&&\end{array}\right]$$
As not detailed further in the book, tried to fill the rest of the table as shown below:
No choice apart from $ba=c$, also no choice apart from $bb=a$.
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} & e &a &b&c \\ \textbf{a} &a&e&c&b \\ \textbf{b} &b&c&a&e\\ \textbf{c}&c&&&\end{array}\right]$$
Similarly, the last row has restrictions as no choice apart from $ca=b$; $cb=e$.
$$Case \ II \ (c) :\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{a} & \textbf{b} & \textbf{c}\\ \hline \textbf{e} & e &a &b&c \\ \textbf{a} &a&e&c&b \\ \textbf{b} &b&c&a&e\\ \textbf{c}&c&b&e&a\end{array}\right]$$
But, it is unclear how the substitution has made the table like that of Case I.

Doubt $1$:
For an Abelian group, we need $xy=yx$, i.e. when $x=y$ (i.e. along the diagonal), we have $x^2=x^2$ but $x^2$ need not be equal to the identity. We do not need all diagonal entries to be identity or this will further impose the condition that every element is its own inverse. This is not a requirement for an Abelian group.
Doubt $2$ and $3$:
View case $(II)(a)$ as the case where every element is its own inverse and case $(I)$ as the case where exactly $2$ elements have itself as its inverse.
Replace the element besides $e$ with itself as its own inverse as the 'sun'. Then for element that are not equal to the identity and the 'sun', we call it the 'moon' and the 'earth'.
Then table $I$, with $c$ as the 'sun':
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{moon} & \textbf{earth} & \textbf{sun}\\ \hline \textbf{e} &e &moon&earth&sun \\ \textbf{moon} &moon&sun&e&earth \\ \textbf{earth} &earth&e&sun&moon\\ \textbf{sun}&sun&earth&moon&e\end{array}\right]$$
Table $(II)(b)$ with $b$ as the 'sun':
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{moon} & \textbf{sun} & \textbf{earth}\\ \hline \textbf{e} & e &moon &sun& earth\\ \textbf{moon} &moon&sun&earth&e \\ \textbf{sun} &sun&earth&e&moon\\ \textbf{earth}&earth&e&moon&sun\end{array}\right]\tag{1}$$
As an exercise, fill in the table according to $(1)$
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{moon} & \textbf{earth} & \textbf{sun}\\ \hline \textbf{e} & & && \\ \textbf{moon} &&&& \\ \textbf{earth} &&&&\\ \textbf{sun}&&&&\end{array}\right]\tag{2}$$
You should be able to see that the two tables are equivalent.
Table $(II)(c)$ has $a$ as the 'sun'.
$$\left[\begin{array}{c|cccc}* & \textbf{e} & \textbf{sun} & \textbf{earth} & \textbf{moon}\\ \hline \textbf{e} & e &sun &earth&moon\\ \textbf{sun} &sun&e&moon&earth \\ \textbf{earth} &earth&moon&sun&e\\ \textbf{moon}&moon&earth&e&sun\end{array}\right]$$
Again, fill in the table and compare with the first table.