Keith Richards states that he came up with the guitar riff for the song in his sleep, waking up in the middle of the night, recording the riff and the words "I can't get no satisfaction" on a cassette recorder and promptly falling back to sleep.
WIKIPEDIA