I was reading yesterday how singer songwriters came up with some of the more famous songs over the years.. for example the root chords of Smells like Teen Spirit are a variation of the chords from Boston's More than a Feeling. Kurt did this intentionally and would sometimes lead into Smells Like Teen Spirit with the chorus of More Than a Feeling while playing live.
Sweet Child O' Mine's opening riff was a guitar exercise Slash practiced to skip strings. Axil heard it and declared it a riff. Also the "Where do we go now?" part of the song came about literally because they had no idea where to go with the song next.
The Rolling Stones I Can't Get No Satisfaction, is written to simulate sex without climax. It builds up to nothing...suspense without release.
and here is Mike Oldfield explaining how he came up with the famous Tubular Bells riff.