Kehaulani nailed it - and since "The Goal Note Approach" by Shelton Berg was mentioned - and in reference to the question about "patterns" and "riffs", I knew Shelley, I took improvisation from him before he put it all in that book, and he emphasizes up front that the more successful jazz solo is usually 'a COMBINATION of 'licks' and 'lines'". Repeated licks can build tension, and/or create a melodic basis for the "line" to embellish.
Meanwhile, "The Goal Note Approach" is about focusing on how chord tones resolve (how they have always resolved in the Common Practice Period), as opposed to, say, thinking in terms of "scales" or invoking the needless complexity of 'modality' in music that is, in fact, "Tonal, not modal".
Those who have referred so much to "melody" are, in effect, saying the same thing, because "tonality" and incorporating chord-tone resolution is exactly how a "melody" functions.
Shelley once showed us transcriptions of two Sonny Rollins solos on the same song, played TEN YEARS apart, and Sonny played the SAME turnaround on the 8th chorus in both solos, LOL So the point of that is that you will always be much more likely to "improvise" with elements you have practiced, than suddenly find yourself blessed by the spirit and muse of Dizzy and play something you've never actually played before. Not to say that it never happens, but you probably shouldn't depend on it, LOL
Another thing he always said was "Listen MORE than you play".