Improvisation - be like a chameleon
Learning how to improvise is akin to being a chameleon. Where do you need to blend in or stand out musically? What's the context in which you're joining (musically)? Improvising requires removal of ego and self-consciousness, but also requires confidence in yourself and your instrument, or rather your knowledge of and skill in your instrument.
If you're too worried about what you're playing, then you aren't in the moment. If you aren't in the moment, then you've probably missed 'the' moment. That's a lot of what improvisation is about. Obviously, it is extremely important (or should I say 'key'...yes I went there), that the musician know their music theory, their scales, and the songs themselves. But if you're too busy thinking about what you're going to play rather than just playing, you've probably missed some beautiful, organic, magical musical moments. But moments like this can only truly happen well, if you know your instrument like the back of your hand.
Speaking from experience, the moment my brain goes into 'over-think'/'over-analyze' mode, there is an audible difference in my playing or singing, even in the sounds or tone I'm creating. However, if I'm listening to the music around me, played by my counterparts (unintentional pun, I swear!), the spaces that I can "fit" into appear.
I primarily use improvisational music playing in a "worship" context - as in on a worship band. So my experience can be primarily "limited" to that experience. Not belittle that experience, when I've sung with jazz groups, the principle is the same. LISTEN to those around, and go for it. Know the music, know the keys you're in, know your bandmates. But really the big one is, get out of your own way and just go for it.