How many ways are there to place $2$ identical kings on an $8\times 8$ chessboard so that the kings are not in adjacent squares? This problem needs also to be extended to $n*m$ chessboard. I tried to think like this:

First I choose a place for the first king in $64$ ways. Then I have a  choice $64-5 = 59$ squares for the second king . But this solution is not right because this is not the case if I place the first king in the sidemost layers of squares. Then I have $64-4 = 60$ squares for the other king. How can I solve this problem?
The first King could be on a corner square($4$ ways), leaving $60$ other squares for the next King.

The first King could be on a edge square($24$ ways), leaving $58$ other squares for the next King.

The first King could be on a central square($36$ ways), leaving $55$ other squares for the next King.

This will double count the configurations, so we have $(4 \times 60 + 24 \times 58 + 36 \times 55)/2 =\color{red}{1806}$.
We will solve the problem by cases.
1) We put the first king on the corner square. Then there are 4 ways to do it, and for the second king we have 64-3=61. Then there are $4\cdot61=244$ ways to do it.
2) We put the first king on the edge square. Then for the first king $6+6+6+6=24$ ways to do it, then for the second it is $64-4=60$ ways to do it. So it is $24\cdot60=1440$ ways to do it.
3)We put king neither in the corner, nor on the edge. So we have $6\cdot6=36$ ways for the first king and for the second $64-5=59$ ways to do it. So it is $36\cdot59=2124$ ways.
So together it is $(2124+1440+244)/2=1904$ ways to do it.  We are dividing by 2 because we are double-counting when we analyze cases, because the order of putting kings doesn't matter.
And now, I think, it is easy to generalise it for $n×m$ case.