This is a long history lesson. I will do my best to make it at least mildly entertaining.
For a hundred years after the Civil War, racists voted with the Democratic Party, because Lincoln - a Republican - freed the slaves. For that entire century, 1865-1964, the states of the Confederacy went for the Democrat in virtually every presidential election. (The South is not of course the only place there were and are racists; they've just always been more concentrated there, and racism is the motivation for the vote of more people there.)
Now, for that same period the majority in most of the rest of the country was Republican - in large part for the same reason, that Lincoln freed the slaves - at least until the Great Depression. (The 65 years from the Civil War to the Great Depression saw only two Democratic presidents, so the Depression, and the initial tepid reaction to it, was largely blamed on Harding-Coolidge-Hoover Republicanism.) From 1932 on, the Democrats started enjoying a lot of electoral success, buoyed by solid support in the South, where they'd even vote for a liberal so long as he was of the party that also winked and nodded at their racism.
In 1964 that changed. Lyndon Johnson signed the Civil Rights Act and Voting Rights Act. This was seen by Southern racists - correctly - as an overwhelming rejection and betrayal of a demographic that - however odious - was a core demographic of the Democratic Party. Throwing them out was the gutsiest and - speaking in terms of political, electoral success - one of the most foolish political actions ever taken by a political party. RFK's comment was "we've lost the South for a generation." He was optimistic.
But the realignment wasn't just from Johnson throwing them out. It was also from Nixon, and his strategist Atwater, welcoming them in. The Republicans correctly calculated that there were at the time more racist voters than black voters in the South, and the Democrats had put the racists up for grabs. Atwater calculated ways to appeal to racists without turning off nonracist conservatives - "dogwhistle" framing of anti-minority messages that only racists would understand as such. (The messaging changes over time. Nixon started with "law and order" - to conservatives, that's simply a good priority for government; to a racist, who thinks of crime as something mostly black people do, it's a way for government to attack and punish black people. Later on it was "busing," and "welfare queens," and "affirmative action hires," and Obama's birth certificate. Reagan was a master of the dog whistle: Reagan's first speech announcing his candidacy in 1979 was in Neshoba County, and he consistently focused on "states' rights" - another of Atwater's potent dogwhistles, that nonracist conservatives and libertarians would see as an issue of simple freedom, but which racists understood very well as a shout-out to the Confederacy and Jim Crow, and against all the federal antiracism programs of the 1960s.)
For the 52 years since that realignment, the South has voted for Republicans in every presidential election, except when the Democrats actually ran a Southerner (Carter, Clinton) - and even then they were only able to split the South. Racists have never trusted Democrats since. And Republicans, from Nixon to Reagan to Dubya to Trump, have enjoyed the benefits of the Southern racist vote.
But this also isn't the end of the story. In the 1970s, smart people of both parties started looking hard at Mexico and Central America, figured out that the US was going to start getting a big influx of Hispanic immigrants over the next couple generations, and started planning how to attract this demographic. Republicans came up with a set of plans to appeal to Hispanics, relying on their generally Catholic culture, using another set of "pro-family" messages, including attacks on gays and - importantly - abortion.
This dovetailed with another Republican program. There was a movement in the party at the same time to court Evangelical Protestant conservatives into political activism, specifically involving Jerry Falwell. This movement grew out of a Southern priority opposing affirmative action (Falwell's Liberty University was in danger of losing tax-exempt status under Carter, because it was violating nondiscrimination laws since the university did not allow students of different races to date). But it quickly found its most potent cause, one which the strategists eyeing Hispanics pushed for and embraced: opposing abortion, which had been until then an almost entirely Catholic issue.
(The conversion of Evangelicals to the cause of considering abortion a moral evil and working to see it outlawed is a fascinating story, and one that others cover in detail. It's stunning how quickly and completely the position spread through the conservative Protestant community between 1975 and 1985. But it's a tangent off of what I'm talking about here.)
By the Reagan era, the Republican Party was comprised of corporate money, racists (Reagan and Nashoba County), Evangelical Christians, militarists (Reagan's aggressive militarism helped push military families and military veterans into the Republican Party), libertarians, and gun owners.
At the time of Reagan, this added up to a majority - in 1984 an overwhelming one. But there were rumblings of a problem, and that problem - while it has many forms - was most of all a Hispanic one.
During the decade following Reagan, Hispanic Americans overall came to the conclusion that Republicans, despite pro-family and anti-abortion positions, were very much not on their side. Part of this was economic - Hispanics, like any community comprised largely of recent immigrants, are less well-off overall than the median American, and Republican/conservative policies tend to be bad (or at least perceived to be bad) for working-class and poor people - but also the Nixon/Atwater dogwhistles started producing dramatic blowback.
Two kinds of people hear racist dogwhistles - racists and minorities. You can tune the dogwhistle so that nonracist white people don't hear it, but when you're getting racists excited, you can't stop their targets from noticing too. Hispanics started getting the very clear message that Republicans did not welcome them. (Pete Wilson was one of the grand villains here, in the 1990s. He ran explicitly anti-immigrant ads as a California gubernatorial candidate, and carried the message into his brief presidential campaign in 1996.)
The upshot of all of this is that as the country has gotten less white, Republicans have gotten less popular with everyone who isn't white. (To the point where I've heard conservatives assert to me, out loud and without any sort of shame or hesitation, that Democrats are committing election fraud by being pro-immigration - because Democratic policies can import potentially unlimited numbers of new citizens, who will then be allowed to vote, and vote for Democrats.)
Race isn't the only issue, of course; conservatives - because of their connections to militarists, corporatists, libertarians, evangelicals, and gun enthusiasts - see all of those demographics shrinking relative to the groups most hurt by policies that those groups want - younger Americans affected most by war; environmentally literate people horrified by dismantling of regulations; working-class and poor people affected by shredding of the safety net and commoditization of their labor; women and LGBTQ affected by anti-gay, anti-abortion restrictions; and city dwellers who are most negatively affected by gun ownership.
Yet they are in a spiral, since they cannot turn their backs on any of these increasingly unpopular positions without alienating one or more of their core demographics.
They've tried hard. There are elected Republicans who really, really wish they could write sensible environmental regulations - but they can't, because of their corporate influences. There are *many* elected Republicans who want desperately to reform immigration - but their racist core would bolt. There are those horrified by the inability of their party to do anything humane about health care - but neither libertarians nor racists would tolerate the "something for nothing" aspect of taking care of poor people's health.
And now, those who simply see a case for Republican conservative policies - those who believe in a largely free-market capitalist society that rewards work and success, and pays attention to patriotism and tradition, but has supports that strengthen the community, take care of citizens who need help, and is inclusive and welcoming to everyone - have to be feeling a gradual sense of dread and panic.
Because they also know, or believe they know, that Democratic policies are very, very sticky. Social Security, Medicare, and Medicaid - which many conservatives believe to have negative impact on society overall - are permanent fixtures of our nation. Moreover, the electoral success of FDR and JFK/LBJ (which was halted by Vietnam and by Johnson's choice above) showed that voters respond very positively to successful Democratic programs (even though a Republican will make the case, whatever one thinks of it, that these policies' short-term benefits are outweighed by long-term costs, both economic and cultural).
So Republicans, I believe, are convinced that their gains are hard-fought and temporary, while Democratic gains - when Democrats are allowed to govern - are easy and permanent.
And - this is the critical piece of motivation I think we should understand, and the reason I went through all of that history, to illustrate the deal with the Devil they made - they see their demographic doom upon them. They know they can't expand beyond their current demographic limits. They are very, very aware that their last Presidential popular vote victory was 2004 and the one before that was 1988. They have won the popular vote in only one of the last seven presidential elections. There are more of us than there are of them and that is not going to change.
They see barbarians at the gate, everywhere. They are outnumbered and they know it. And they honestly see themselves as the last defenders of civilization and freedom, in constant danger of being overwhelmed and their light extinguished.
Needless to say I don't share their view in the slightest. But I believe I am accurately representing it. And I believe I understand it.
And when I put myself in that mindset - the last defenders of civilization - I understand their desperation. Why they embrace what seems insane. Why they are so willing to be so desperate. Why they fought Clinton, and then Obama, so furiously and relentlessly, never compromising and never allowing a single success, even one that had the potential to help enormous numbers of citizens without containing anything resembling actual "liberal" ideals (e.g. the PPACA).
They can't let us win even temporarily, because they are convinced it will be permanent. If we peel off anyone from their coalition, they'll never build it again. There's no one left for them to add. Too many Americans are nonwhite, or LGBTQ, or working-class, or nonreligious, or against guns, or in favor of abortion, or want some amount of services to provide support in an increasingly complex and demanding world. More all the time.
And all it takes, they believe, to cement an effectively permanent Democratic supermajority is for people to see a Democratic success. (They know Democratic policies help people. They're not stupid. They just think it's bad for the country to help people.) I'm not exaggerating or making this up when I say they believe they can't afford there to be a single opposition success; I've seen the position papers Republicans published under Clinton and under Obama. They have been frank about seeing relentless, total opposition as their sole path to survival.
And now that they're in charge they will literally do anything it takes to stay there, because they believe it's the last chance for their philosophy - and remember, they believe that any other philosophy than theirs leads to the downfall of civilization. This isn't evil, per se, it's desperation - or rather, it's what real evil in the real world is: not moustache-twirling sadism for the sake of it, but convincing themselves that every part of what they do, no matter how many people it hurts or what sacred traditions it destroys, has to be done to save humanity.
They can't back down, ever. On anything. They can't admit a single wrongdoing by anyone in their party. They can't quit even so awful and unfit a clown as Trump, because a weak hand going into 2020 could permanently realign the nation against them. No tactic is beyond them because they see - always - the apocalypse coming with the next election and they must use every weapon at their disposal. They are willing to throw even our ideals of free and fair elections to the winds, convincing themselves that's not really what they're doing - they're just temporarily making voting a little harder for people who probably wouldn't have voted anyway, what's the harm - who cares if there was foreign influence in our elections, they have any number of excuses for why that isn't as horrifying as it sounds - because they honestly believe the future of all mankind and all civilization depends on their victory over us.