Assume we have a very unpopular pair of president and vice president A, B. Now A is facing an election to be re-elected. Can A just quit his/her job to let B become the president? If A, B's personal interests are highly linked, then A could let B choose A to be the vice president again in future, and by letting B quit again, A would be president. So this process can go on forever. Is there any logical mistake in my reasoning? I ask because obviously no one did this in history ever. Assume quite of few of the presidents are very intelligent, greedy, authoritarian people, then this seems a legtimate solution to become the de facto life time president of United States.
You seem to be assuming that the President resigning means the Vice President starts a new four-year term. That's not how it works: if the President resigns, the Vice President serves out the term, but when the original term is up, there are elections. That's why none of the Presidents who have left office mid-term have changed the US election cycle: when Nixon resigned in 1974 (the one president to have resigned), the next election didn't change to 1978, but rather stayed at 1976 where it'd be if Nixon hadn't resigned. Ford only got two and a half years as President.
So, your scheme wouldn't work: the President and VP could resign as much as they want, but when the elected term expired, there would be new elections and they'd both get kicked out for making fools of themselves (leaving out that the Senate wouldn't give its advice and consent to the old President as new VP, and if the President and VP tried this they'd both find themselves impeached for deciding to mess around with weird governmental procedures instead of doing their job, they would have no chance of winning reelection and couldn't even theoretically win more than four times together).
Also, I think the Supreme Court would likely read the 22nd Amendment as applying to the Vice President as well (the 12th Amendment says that the VP must be constitutionally eligible to assume the office of President; there could be a case made that that means they must be eligible to be elected). But the main thing is that the VP does not get a new four-year term when the President leaves office early.
No, there is no rule or anything preventing the President from just quitting.
Why don't Presidents quit, even when they are unpopular? A few reasons:
1. Incumbent Advantage An incumbent president nearly always wins. It is highly unlikely that an incumbent will be lose to a challenger. Even when a president is unpopular, odds are they will win their re-election.
2. Experience By the time someone becomes president, they are a highly skilled politician. Even if they are unpopular, they know how to handle unpopularity and win elections.
3. Rewards of Office There are rewards for office that are hard to give up. Air Force One, the White House, and of course all the prestige and power that come up with the position. Why give it up just because you will eventually lose it?
Each President may have their own reasons, but these are some common ones.