He was a prolific songwriter and often gifted songs to artists he admired. Some of these were huge hits; others simply demonstrate his musical genius