Mostly, your instinct will tell you.
But fundamentally, when your playing partner has drifted across mainly to your side (usually a result of assuming a net position and making volleys), it is time to move more to the other side in order to cover any shots the opposing pair might make into your 'open' court.
Chat with our AI personalities
Usually the players switch ends after every other game of a match. They begin switching after the first game, so they will change every odd numbered game: 1st, 3rd, 5th, 7th and so on.