Solution:
Let us fix a coloring of the first row of the chessboard. This can be done in 2n ways (2 choices for the color of each of the n squares). Let us now show whether and in how many ways a coloring of the first row can be completed to a coloring of the whole chessboard satisfying the required conditions. From now on we will simply call a completion of a coloring a completion that satisfies the conditions of the problem.
First case: the squares of the first row have alternating colors. The possibilities for this type of coloring of the first row are 2: if the first square is colored red, then the second is colored blue, the third red, and so on. Conversely, if the first square is colored blue, then the second is colored red, the third blue, and so on.
In this case the completions of the coloring to the second row are exactly those with alternating colors, that is, 2. Similarly, for every completion of the second row there are 2 completions of the third row, and so on, for a total of 2n−1 completions and hence 2…2n−1=2n possibilities relative to this case.
Second case: there exist two adjacent squares of the first row with the same color. The possibilities for this type of configuration are all the ones minus those for the first type of configuration, that is, 2n−2.
One way of completing the coloring to the second row is certainly to color each square of the second row differently from the square above it. On the other hand, this is the only possibility, since below two adjacent squares of the same color there must be two squares of different color, and hence necessarily to their left and to their right there must be squares of a different color from those above them, and so on. In conclusion, there is only one completion of the coloring to the second row. Similarly, there is only one completion of the coloring to each row following the first, for a total of 2n−2 possibilities relative to this case.
The total number of colorings is therefore the sum of those relative to the first and second cases, that is,
2n+2n−2=2n+1−2.