David Letterman has been all but begging Sarah Palin to grace his couch with a visit, but it was his competition, Conan O’Brien, who was granted the favor of a drop-in from the former vice-presidential candidate Friday night.

Mrs. Palin made a surprise walk-on appearance with Mr. O’Brien on NBC’s “Tonight” show, as a counterpoint to a dramatic reading — complete with bongos — by the actor William Shatner, from her autobiography, “Going Rogue.”

Mrs. Palin, the former Alaska governor, walked out in front of a stunned and delighted audience and performed a dramatic reading of her own — also accompanied by bongos — from Mr. Shatner’s autobiography, “Up Till Now.”

She included passages dealing with Mr. Shatner’s days on the show “T.J. Hooker” and a reminiscence of the night he visited Johnny Carson and thought the host looked like Mr. Spock on the “Star Trek” episode when his brain fell out.