I didn’t think that was possible!
I watched a clip of McCain on Leno the other night. My best guess is that someone flatters McCain by pretending he is intelligent and then tells him what to do and say. He is too clueless to know he is being manipulated, but is intelligent enough to remember what he was told to say.
My second best guess is that he is being paid to say what he says.
In either case, he loves the attention and as long as he stays on camera or in the news he is happy.