To answer this question, one should know how human brain works.
As other people quoted, music is a combination of frequencies.
I think these are the key factors that makes a piece of music.
1) Frequency (note)
2) Amplitude (volume)
3) Noise or wave structure (instrument/source of the wave)
4) Pattern (what comes next after a particular note)
5) Repetition (keeps the listener in the same mood)
6) Timing/Beat (gives predictability to the flow)
As you can see it is pretty complex. Yet I think the last three are the major contributors to the " quality" of the music.
Is there a mathematical relation between these that makes a "good" music ? I think it works the other way around. ie: if you find good music, you can find a math relationship. But as far as I know there is no equation for good music.
I have learned Indian music which I think has more "flow". What I have noticed is that #4 in the above list is the biggest contributor. By changing just one note in a pattern you can generate a completely different piece of music.
In short.. ask your brain :)