Here is a passage from Notes and Comments on Robert's Rules, Fifth Edition, p. 160:
When may the chair vote?
In theory, the presiding officer has the same voting privileges as every other member. In practice, the chair voting by voice or show of hands conflicts with the chair’s responsibility to remain impartial. Robert’s recognizes the right of the chair to vote, but suggests that the chair protect impartiality by “exercising his voting right only when the vote would affect the outcome” (4:56). As a result, a chair can break a tie by voting in FAVOR of a motion (causing it to be adopted) OR can create a tie by voting AGAINST a motion (causing it to be lost). The principle also works in reverse if the chair chooses not to vote: when the vote is a tie or a motion is adopted by one vote, the chair affects the result by choosing not to vote. If the vote is a tie, the chair in effect votes against the motion by declining to vote in favor. If a motion is adopted by one vote, the chair in effect votes for the motion by declining to vote.
The statement is sometimes heard that a chair can “only vote to break a tie,” which is wrong. The phrase break a tie should be replaced with affect the outcome. The same principle applies to decisions requiring a two-thirds vote.