You have two question conflated into one: finding a suitable major/minor scale for a group of tones, and how the "pros" find a key of a melody.
Those are not the same thing.
For the first question treat major/minor scale as synonymous with key signature and you should be able to step up the accidentals of the various key signatures to find if the set of tones fit a major/minor key...
C,F,D ... or perhaps C and G#? ... or perhaps C, G, A#
The first sharp for key signatures with sharps is
F# that doesn't match the set
C,F,D all other key signatures with sharps going up the circle of fifths will contain an
F# so none of the sharp key signatures will match the set. Going in the flat direction we go
Bb, Eb, Ab, Db when we get to the
Db we have a tone that doesn't fit the set and so we stop and know the set can't fit any key signature with 4 or more flats. That gives us key signatures of 0 sharps/flats, 1 flat, 2 flats and 3 flats which will match the set of tones
C, F, D.
Things get complicated when considering minor scales.
C, G# won't fit a key signature with sharps (and of course not flats), because to get to a
G# we will first hit upon a
C#, i.e. there isn't a key signature with
G# that doesn't have a
G# would be used for an
A minor scale. A quick way to try figuring this out is ask if one of the tones could be a leading tone.
A# could be the leading tone to
A minor and the
C would then be the mediant, the
A minor scale could be used. In the case of
C, G, A# non of the tones can be a leading tone for a scale containing the other tones:
C leading tone to
Db minor, but
A# don't fit, and so on with the others.
Things are further complicated when you realize that every note of a melody does not need to fit a scale. In the case of
C, G, A# the scale to use might be
C major where the
A# might be the chromatic lower neighbor tone leading up to a
B. But we can't figure that out from just a list of tones. We would need to see the actual melody.
This makes a nice segue into the second question about finding a key. Both questions seem to be generally about figuring out the tonality of a melody. But you can't do that simply from a list of tones. Sequence, repetition, rhythm, etc are all essential for perceiving tonality. If someone presented a list of melody tones
D, E, F#, G, A, B, C, you simply cannot tell what key the melody is in. That list of tones could be used for multiple keys:
E minor, etc. or it might not be in a key at all! You must see the actual melody and understand what it is doing in terms of major/minor harmony (implied harmony if there is only a melody.)
Just a quick addition to demonstrate how a list of tones will not be enough to determine a scale/key: consider this set:
C, C#, D, D#, E, E#, F#, G, G#, A, A#, B, B# ...in what key or scale should is that set? Note the enharmonic spellings
C for a total of 13 tones in a major/minor system that uses a 12 pitch chromatic scale! Tones are not in melodic order but in ascending order from
C. The answer is here.