Rent the movie, "Birth of a Nation" by DW Griffith. it is an interesting take on the start of the Klan. Ever hear statements like: "he was the first black elected to this seat since Reconstruction." During Reconstruction, a lot of carpetbaggers, (white and black Republicans from up North) came down South and stole elections outright. Both blacks and the Republican party in general were somewhat unpopular in the post Civil War South, so how else would they get elected?
The KKK was formed to make sure that everybody got a chance to vote, at least according to the Griffith movie. I don't know how true it is, but I have wondered how so many blacks got elected in that era. Remember in the movie, Sommersby, the black judge all but admitted that he got his position through questionable means.
Look at the suddenly enfranchised black populations of those states. In some states the slave population exceeded the free white population. In almost no slave state (outside the border states) were slaves less than a quarter of the population. They usually fall about 60/40.
On top of that, many men who fought for the south were now disenfranchised until they took an oath of allegiance, further suppressing the Democratic base.
Now, who do you think a just-freed slave is going to vote for? The party that was running things when he was a slave? Or the party that led to his freedom? A white who probably owned slaves himself a few years ago, or a fellow former slave?