Some guys will listen to the greats and try to learn the licks note for note slowing passages down to catch the details. Good luck with that in most cases. My own approach, never having had the patience to sit and study anything was, as Diki mentioned, jam along with the radio, records, etc. I won't pretend that I'm a real musician but, yes, the tune is in my head before it's transmitted to my fingers. I don't know how that works or how I manage to even do that. I guess we all do it our own way.
My dad and I would listen to Smith, McGriff, McDuff, and others and he'd say to me, "See, everything those guys play comes, in part, from somewhere else and, in part, from within. Take from what you hear them doing, and add yourself into the mix. Stay with that and you won't go far wrong." True then, true now. This all rang true to me when a bass player we had told me I'd managed to make my own style. He said that he'd know it was me playing before he even entered the room. That's a great compliment.
It's all about pushing envelopes.