At the risk of scrutinizing what may be very obvious, the people gave the title
Pudd'nhead to Wilson because he was thought to be unintelligent, having pudding
instead of brains. When he was revealed to be intelligent, the people who
thought he was stupid realized they were stupid to think Wilson was. The people
had elected him to the position of village idiot; he resigned by revealing
intelligence, thus vacating the office of idiot by reason of being unqualified
for it. In doing so he caused his detractors to fill that office. It isn't so
much a pun as an analogy for the process of an American political office, such
as the presidency, becoming vacant by death or incapacity; the vacancy is filled
by the vice-president or another subordinate.

There is a bit of analogy with Twain's general dislike of politicians and
royalty in that there are occasional glaring exceptions. One would be Twain's
admiration for President Grant; another might be in the comment by the
Connecticut Yankee admiring Arthur, that he was more than a king, he was a man.

Correct me if I'm wrong.
--
Be of good cheer.

Dick Ford