This is a never ending rabbit hole. There is no such thing as a perfect tuning, and there are centuries of efforts to at least get a better tuning for purpose. Fretted instruments have it even worse.
In principle you want the ratios of frequencies in the scale to sit on simple ratios. A fifth is 3:2, that is a fifth is found by multiplying the base note by 3/2. Other intervals can be found by other nice round ratios. But even now you get into trouble. The Pythagorean scale is built out of 2s and 3s.
Just Intonation is generally considered to be the best scale, as it builds the scale out of 2,3,and 5 and their multiples. Even now you get two different tone internals, there is a major tone 9:8 (3\times3:2\times2\times2), and a minor tone, 10:9 (2\times5:3\times3). Keyboards to provide Just Intonation have split keys to get you the extra notes.
Even here you are in deep trouble. Musicians want to transpose and shift keys. On the same scale that you set out a consonant set of intervals, if you move to a different key centre, all the intervals go wrong. Hence equal temperament, where every note is out of tune, but spread evenly so that the result is consistent. The semitone is defined as the 12th root of 2, so that 12 semitones exactly makes an octave. No interval ever lands on a nice integer ratio in equal temperament, but every semitone is identical, so moving key does not lead to problems.
In principle guitars and pianos are tuned to equal temperament. But in reality they are not.
On a guitar intonation is set to take into account the string’s width, which acts to reduce it length slightly, and acts to move the harmonics out of tune with the fundamental. The act of fretting disturbs things as well. Typically the nut is positioned very slightly short to help get the intonation right for open strings, and the bridge set to take account of the differing string widths. But even then you get into trouble. A good guitar tech will set the guitar up so that it play well in one part of the neck, depending upon the player. This is again spreading the pain about. Chords will sound better in one part of the neck to others. But intrinsically it is impossible to set it up to play in tune everywhere, and some chords will sound more consonant than others.
There is the Buzz Feiten system, where he worked out a nut position and precise offsets for string tuning that is supposed to work well for Jazz style chords.
Overall answer. There is lots special about the musical scale. But there is no one true musical scale. Just Intonation is what people like Baroque players try for, but often need to settle for things like 1/3 comma Meantone. Which means - all tones tuned to the same interval, and the semitones no worse than 1/3 of a Syntonic Comma (an error in tuning of 81:80).
You can write, and there are, PhD theses on the subject.
At root, the problem is that the unique prime factorisation theorem tells you, a-priori, that you can never get one true scale. You chose your poison.