To learn how to improvise it is helpful if you work with a tune you have already memorized and do not have to be reading as reading keeps your mind engaged while you are trying to let go of thinking. So if you have a tune you know by heart you can start getting into improvising more readily.
So let’s say you are playing Mary Had A Little Lamb.. and you want to start improvising and playing it slightly different then it is written… well if you play it in the key of C… (all white notes) it will help.. and just play the melody to start with… and play it several times… then start wandering away from the melody line just a few notes to the right of the melody and then a few notes to the left… for instance… try this … play the middle E note.. then middle D… then middle C….as in E-D-C-D-E-E-E……D-D-D-E-G-G…. Ok that’s how it is written.. so lets try wandering around in the melody but keep it close to home…. like this…E-D-C-D-E-G-G….D-G-G-E-G-G… improvise.. be creative.. but keep the melody and your forays into improvisation in the beginning close to home… and this applies to all songs.. pop and classical…. take a chance… keep the chords the same but get into playing the melody slightly different everytime.. and you wil start getting into the habit of being a little creative and improvising around on everything you play.