sheriff elections from 1958 through 2018 and found that not only did sheriffs serve longer terms, but they also remained in office even when the political trends of their county changed.
One of the reasons sheriffs persist in office despite changing attitudes is that they create effective lobbying groups in the form of, which usually include every elected sheriff in a state. While some sheriffs may be Democrat and more liberal, state sheriff associations skew much more right-wing and are often dominated by the sheriffs in more conservative, more rural counties.
Which gets us back to the need to de-politicize law enforcement. Elected positions need to be eliminated. Replaced with positions selected through a hiring process with required credentials.