Solution:
For an m×n chessboard there are 2m+2n−2 ways.
Case I. There are two horizontally adjacent squares of the same color: 2m−2 ways.
Case II. There are two vertically adjacent squares of the same color: 2n−2 ways.
Case III. None of the above: 2 ways.
Hint for Case I: There are 2m−2 ways to color one row so that two adjacent squares have the same color.
The rest of the coloring is determined from that; colors must alternate in each column. (Note, therefore, that Cases I and II do not overlap.)