There's a lot of disagreement here and you might be more confused about this than you were when you asked. There are a number of answers here. None of them are outright wrong and some primarily address the title of your question, and some try to address the specific quote and what is meant by it in context. Unfortunately, I don't think any of them really get the context of the quote quite right. In terms of general question around the idiom 'what does "zigs when others zag" mean?', see Maciej Stachowski's answer.
As far as the specific quote goes, there are a lot of details required to really understand it. First off, this is not about the presidential election as stated/implied in some of the answers. The entire article is about senate elections. Specifically, the section this idiom appears in is about an upcoming election for one of Montana's 2 senate seats. The context of the quote relates to the incumbent senator from Montana since 2006: Jon Tester. So why is Biden mentioned? The reason that's relevant is that senate elections occur every 6 years while presidential elections are every 4 years. (Side note: not every senator is up for reelection at the same time.) It's a well-known phenomenon that when a senator or house seat election aligns with the presidential election, the turnout for elections tends to be much higher compared to 'off-years' when there are no presidential candidates on the ballot.
In 'off year' elections where there is no presidential election, a smaller subset of the voting populace shows up at the polls. They tend to be older and more politically aware. Tester barely won in his last (off-year) election.
In the last presidential election (2016) when Tester was not on the ballot, Trump won the Montana electoral college votes by an overwhelming 15 (percentage) points over Biden. In most states, you can expect that voters will vote along 'party lines'. That is, most of the people who turn out to vote for Trump will vote for 'down ballot' Republicans as well. A lot of Trump supporters will only show up when Trump is on the ballot. All of these facts look bad for Tester.
So finally, we can now get to the meaning of the phrase "zags when other zig" in this context. It's important to understand that the person quoted is an unnamed source who is a political operative likely speaking 'off the record', not a politician who is running for office. The idea they are trying to convey is that perhaps the Montana voters will not vote along party lines as expected in other similar elections for incumbent Democrats in Trump-supporting states. That is, they will go against the national trend and Trump voters will also vote for the incumbent Democrat Senator or abstain.
As to what is meant by 'Montana has that ability', I think we can presume that refers to Montana's tendency to not follow the rest of the country in some (I think) surprising ways. For example, Montana is the only state in the US which doesn't follow a primarily 'at-will' employment regime.