There are many different kinds of answers, so I'll add mine. Long answer. I'm not sure I can write a TL;DR for this.
First of all, the fundamental idea of how I look at the three main dimensions of music - harmony, melody and rhythm - is that they can be completely separate and independent only in theory. In practice, whenever you create a sound, any sound, it has some consequences and implications in all three dimensions. A melody implies or outlines some harmonic possibilities, and how you place your melody notes in relation to the perceived rhythmic pulse, affects the perceived implied harmony.
Whenever you play any note, you poke a stick somewhere into the chords machine. And whenever you play a chord, you change the playfield for a melody line, setting walls and obstacles to bump into. So what is a scale? Does a scale "exist" if you aren't playing all the notes at the same time? In my opinion, the most important way to see scales is just as a reference grid for reasoning about where sounding notes are or could be. Another way to use scales is as construction kits or palettes for obtaining certain harmonic effects. Particularly in songs in minor keys, you'll notice that whatever scale you try to see as the only construction kit or note-set for the song, it doesn't seem to be enough. Natural minor ... doesn't work work this song, there are out-of-scale notes here. Harmonic minor ... doesn't work either, it still leaves some out-of-scale notes!? "What is the scale of this song???" If there's one misconception, myth or wrong idea with how a lot of people see music, that's "every song is in a scale". No! A scale is just an initial starting point, and then things start moving.
How do I improvise in a minor key - exactly the same way I improvise in a major key. I think about and improvise ALL dimensions of music I possibly can, and how much I'm able to do in each dimension depends on things I cannot change and decide on the spot (particularly my skills are a restricting factor). For example if there's a full backing track, it sets a lot of decisions in stone. But if there's only a drum beat, I can create a completely new song. If there's a melody without chords, which is basically the situation in free-form accompaniment of songs, it leaves most of harmony and rhythm open for re-inventing. (just don't confuse or upset the soloist/choir/congregation)
A practical example.
- Let's say the song is in A minor, and you want to move from an Am chord to a Dm chord. You could just do the jump, Am - Dm. If these are the only sounding notes, I guess you'd say that the scale is A natural minor, even though nothing was explicated about a G note.
- But you could do a "V-I into Dm" modal mix: Am - A7 - Dm. What happened to the scale? At least the C note was sharpened in your harmony during the A7 chord?
- How about Am - Gm6 - A7 - Dm? Now during the Gm6 chord your B is flattened, and during the A7 the C is sharp ... and then during the Dm these temporary changes are cancelled.
- But were those the only changes to the scale? How about if you use notes from the A half-whole diminished scale over both the Gm6 and A7? Now you have both C and C# - or is it Db. But you also have D# and E and F#.
- ... but since not a full scale was explicated as notes, were those really the scales, the full scales and nothing but the scales? It's subjective! The composer or improviser might be thinking about a scale, but if they explicate it only partly, the rest is left for imagination. Even with chordal instruments, you usually imply things a little bit, and when playing unaccompanied non-chordal instruments, implying harmony is kind of the whole point. You might think about a full story with detailed situations, but as a story-teller you carefully (or instinctively or "subconsciously") decide which details of the picture you need to reveal to the listener. Do you explicate the harmony loud and clear and extensively in a "for dummies" way, all possible notes must sound, so the listener isn't allowed to draw incorrect conclusions? Or do you allow for some feeling of mystery?
Some more examples:
- If the song is in A minor, and there's a fixed melody but it doesn't happen to use the F note for awhile, I can use a backing D or Bm chord, creating an A Dorian feeling.
- If a rhythm section is playing Am and I get to improvise the melody, I can still outline a D major chord for the same A Dorian effect.
- If the melody has come to rest at A and I can improvise backing chords, I might play a chord sequence: C, B, Bb. If there's a soloist and they hear these chords, they have to react - for example on the Bb chord they'll most probably want to avoid playing a B note.
- If the song is sitting on an A minor tonic, I might play an Am6 or Am maj7. Why? Because I like how those chords sound relative to an A tonic.
If I had to describe what I think about when improvising, I'd say that I think of fully extended chords as my target points - basically the sound of an entire scale. But the scales are created, composited from parts! I throw notes and chords into the soup, and a scale is created. What a scale is called ... is irrelevant because they are being molded like clay all the time anyway.