This is a matter concerning which rulings may differ according to different circumstances in different times and places. There is no absolute ruling that covers all situations, real or hypothetical.
In some cases it is wrong to vote, such as when the matter will have no bad effect on the Muslims, or when the Muslims have no effect on the outcome of the vote. In this case voting or not voting is all the same. The same applies in cases where all the candidates are equally evil or where they all have the same attitude towards Muslims.
It may be the case that the interests of Islam require Muslims to vote so as to ward off the greater evil and to reduce harmful effects, such as where two candidates may be non-Muslims but one of them is less hostile towards Muslims than the other, and Muslims’ votes will have an impact on the outcome of the election. In such cases there is nothing wrong with Muslims casting their votes in favor of the less evil candidate.
In any case, this is the matter of ijtihad based on the principle of weighing up the pros and cons, what is in the interests of Islam and what is detrimental. With regard to this matter, we have to refer to the (local) people of knowledge who understand this principle. We should put the question to them, explaining in detail the circumstances and laws in the country where the Muslim community is living, the state of the candidates, the importance of the vote, the likely benefits, and so on.
No one should imagine that anyone who says that it is allowed to vote is thereby expressing approval or support for non-Islamic regimes. It is done in the interests of the Muslims, not out of love for the disbelief. The Muslims rejoiced when the Romans defeated the Persians, as did the Muslims in Abyssinia (Ethiopia) when the Negus defeated those who had challenged his authority. This is well known from history.