I think the idea your question relates to is the circle of fifths.
Any key signature will have 7 pitches.
When comparing keys there will be a varying amount of pitches shared from none to 6 out of 7.
To keep things simple lets compare only major to major and minor to minor.
If you compare C major to C# major, there are no shared pitches. All 7 are different.
The greatest possible amount of shared pitches must be 1 less than 7. Obviously if all 7 pitches are shared you would be comparing the same keys.
Key whose tonics are either a descending or ascending fifth apart will differ by only one pitch. In terms of key signatures descending a fifth will add a flat (or remove a sharp) and ascending a fifth will add a sharp (or remove a flat.)
That relationship of keys by fifths is of course the circle of fifths.
also - why is it the case that its mostly flatter keys two tones share
in common rather then sharper keys?
This simply isn't true, but it's easy to understand why that doesn't make sense. Music works on relative relationships. Ex. chord
V7-I shows relative relationships rather than concrete labels like
G7-C. These relative relationships are transposable. If two tones are shared by two keys -
F & C are shared by F major and D flat major, then the same is true of any two keys 4 steps apart on the circle of fifths.
B & E are shared by C major and B major.
I think I read something about it how progressions tend to go into
flatter keys and it seems there some fundamental reason for it?
This sounds like a mix up of the circle of fifths and chord root progressions by descending fifths. They aren't the same thing. There is a circle of fifths arrangement of key signatures and there is the separate circle of fifths harmonic sequence. Root progression by descending fifth - ex
C to F - is considered the "strongest" progression. If you casually look at the circle of fifths C major to F major looks like that chord progression and it does seem to move into keys with flats. But the complete circle of fifths harmonic sequence does not match the key signature circle of fifths.
The full circle of fifth harmonic sequence is diatonic. Notice how all the roots stay in the key of C major and the move
b is diminished fifth...
C F bdim em am dm G C
The key signature circle of fifths is chromatic. Notice that the roots leave the key of C major by the 3rd step and all the moves are perfect fifths...
C F Bb Eb Ab Db Gb B
The point is to not mix up harmonic root progress by descending fifth with steps along the key signature circle of fifths.