Improvisation is common in many types of music, but is mainly expressed in jazz. The songs that all jazz soloists should be familiar with are called standards. These songs are not usually practiced collectively as they are so well known. A player can expect to build his own solo jazz part upon a standard usually. The jazz standards must be learned by all aspiring players . The structure of the song must be memorized and understood prior to attempting a solo. You will find that if you understand music it can be an invaluable skill when it comes to this task.
The soloist usually will not begin prior to the main melody of the song being played once through by everyone. It is important to know how long this will take as it will be your cue to begin your solo. You will receive a nod by the leader of the band to begin your solo when it is your time in any case. If there is a solo singer, your part will come after theirs.
Only training and a good understanding of musical structure will be the building blocks of a great jazz improvisations. Knowledge of the structure of a song will give you a road map of where your solo should go. This is where all the time you spent practicing scales will bear its fruit. A good jazz improvisation solo combines your knowledge of scales with your knowledge of the chord pattern of the song itself. If you find it difficult at first to build a solo, try playing arpeggios in the key signatures as you move through the song.  A good solo is not simply combining scales one to another. The jazz solo should have something to say after all, so do not just play scales by rote. You cannot know the exact way you will get through your solo, but you can know generally how you will get there.
Most jazz improvisations start with at least a general understanding and statement of the melody. A simple start allows for a greater latitude in expression as you move through the solo. As you go on through your solo you can increase the tension, dynamics and tempo before resolving to the main melody at the end. Listen to some favorite jazz solos that you know and see if the pattern is not the same as what we are describing here.
Listen to other instrumentalists to hear how they do their jazz improvisations. Go to concerts, buy recordings and learn how to build your own jazz musical solo. In time you will know what the pattern of a good jazz improvisation is intrinsically without being told.