In a voting system like we have in the US (“plurality voting”), we may apply something called the median voter theorem. The median voter theorem says that in a face-off between two candidates, the candidate closer to the median voter wins. Here we’re assuming a one-dimensional preference scale (e.g. left to right) and that voters choose the candidate who is closest to them on the scale. The winning strategy for each candidate is to move closer to the median until they are nearly indistinguishable, and each has about 50% of the vote.
As a result, you can see many politicians shifting their views over time, carefully tracking the median view. In the US, voters seem to be uncomfortable with this optimal strategy, and thus they demand that politicians put on a show of having believed in their current views all along. And then when politicians visibly contradict their previous views it’s used as a gotcha. This is incredibly tedious.
Of course, it does not really seem like the major candidates follow the median. Trump and Clinton, are, after all, very far apart! In fact, I’m puzzled why US presidential elections don’t hew more closely to the median voter theorem. I imagine this is a subject of study for political scientists, but I only have baseless speculation to offer. And of course I’m ultimately trying to say something about the current election cycle.