Previous to learning scales, for me it was very much hit or miss. Certain notes following each other became familiar, rather like using the same few words in several sentences. When I knew scales, it changed rather. Listening to a piece, a key is established, the sort of scale used is recognised, and the fingers (usually) tend to follow the tune automatically. As in - this is a blues in D, therefore all, or at least most, of the notes will be from the D blues scale, and will be found here. Or put another way - these particular notes WON'T be used, probably, so don't even try to play them.
Players who have only ever learnt from dots will most likely have the musical names somewhere in the concious mind, but after a lot of playing this changes to interval recognition and scalar runs and arpeggios, or at least part of them.
Players who learn by ear often take longer to assimilate tunes, although again, it comes down to 'muscle memory', but of a different kind to that in the second para.
Instrument knowledge is another factor, with some guitarists thinking 'tab', which obviously wouldn't work for most other instruments. A lot of players - sax, flute, blues harp, to name a few, cannot rely on eye to brain co-ordination, so there's going to be a different approach there. And that's before one considers the voice.
Jazz players may think a scale per chord, so their mindset is very different, but they certainly won't be thinking 'I've just played a D and the next three notes will be E, F and then C#'. I think after a certain amount of time, which varies for each of us, the thinking part of the brain ceases to influence what we play. I've often told students off for thinking!! My analogy is try examining what you are actually doing, while running - heel or toe down first, which arm moves with which leg, etc. You soon won't be running - you'll be in a heap on the ground... So we often surpass the academic stage, to actually produce music, which is far more than the sum of the parts.
Simple answer is there's no one answer, but we all use different techniques, and often a combination of several, dependent on instrument, experience and ourselves.