TO the list of great copy writers in advertising, add an unlikely name: Gary Gilmore.

Mr. Gilmore, the notorious spree-killer, uttered the words “Let’s do it” just before a firing squad executed him in Utah in 1977. Years later, the phrase became the inspiration for Nike’s “Just Do It” campaign.

The episode might make you wonder about the genesis of some other offbeat ads over the years. Where does someone get the idea to write a jingle about Oscar Mayer wiener envy? And how exactly does one dream up a talking gecko selling car insurance?

The revelation about the “Just Do It” slogan is one of many fly-on-the-wall anecdotes that the famous names of the advertising world share in a new documentary by the filmmaker Doug Pray called “Art & Copy,” to be released in New York on Friday.

The film takes some of advertising campaigns that are most indelibly seared into the American consciousness  “Got Milk?,” “I (Heart) NY,” “I Want My MTV,” to name a few  and examines their path from ad slogans to pop culture glory.