When Thad Cochran won election to the Senate in 1978, he became (as his bio touts) the first Republican in a century to win election to statewide office in Mississippi. His tenure very well may end Tuesday night, and looking at how the composition of the state's vote has changed, that should not be a surprise.

Thad Cochran (R-Miss.) leaves a pre-election day rally. (Joe Ellis/The Clarion-Ledger via AP)

Cochran's election came right as the state swung solidly — but not as solidly as you might think — into Republican territory. Looking at presidential election results over time, you can see when the Democratic majority faltered (at first in 1948, when the Dixiecrats won the state's electoral votes) and  then when the Republican predominance kicked in in the late 1970s. (The blip in 1968 is when the state voted for the independent candidacy of George Wallace.)

Presidential elections are an imperfect guide to the state's politics, as you can see from the elections in 1976, 1992 and 1996. Those years, Southern Democrats (Carter and Clinton) overperformed in the state.

Looking solely at Senate elections, a clearer picture emerges. Democratic candidates started ceding more and more of the vote in 1964; by 1984, when Cochran was reelected for the first time, Republicans had a solid majority.

The elections Cochran has won are indicated with a dotted line. The trend is a downward slope for Republican senators over time, wavering up and down with midterm and general elections. Even noting that the 2008 and 2012 elections increased Democratic turnout, the trend is still toward closer general election fights between the GOP and Democrats.

Cochran has also been lucky in another way: He hasn't faced significant primary threats. Chris McDaniel, the man taking on Cochran today, is not only the toughest competition Cochran has faced but one of the only challenges he's faced. In 1996, Cochran crushed  Richard O'Hara. No one ran against him in the primary in 2002 or 2008.

Thad Cochran has been the beneficiary of running during what may be a high-water mark of Republican influence in Mississippi and facing no serious primary competition as that water began to recede (however slightly). Cochran was lucky. McDaniel is running against him in a state with a history of bucking party dynamics and at a moment that incumbency is a disadvantage. Chris McDaniel is lucky, too.