The Democrats’ mistake was in thinking that a disastrous war and national bankruptcy would be of concern to the electorate.
The Republicans correctly saw that the chief concern of the electorate was to keep gay couples from having an abortion.
(I haven’t found the original source for this, but would like to give credit where it’s due.)