u will find that each partial within a particular note might decay in a different manner, and this pattern of decay varies per note.
Tackling the simpler part of the answer, one of the reasons there’s a tendency for higher order partials to decay faster can be seen in a simplified model of string vibrations.
The wave equation of a simple oscillating string, with decay, can be modeled with the formula.
The gist of the formula is: the bit on the left, ψ(x,t), determines the displacement of the string at some point x and some time t. The goal of this wave equation is to determine where every point will be at every time, which is the same as knowing vibration frequency and amplitude. The stuff inside the cosine on the right can be ignored for this discussion. But the key important thing is the exponential e-κx. κ is proportional to the frequency of the wave. Which means as frequency goes up, κ goes up, which means the exponent shrinks, and so the physical displacement of the string from rest is decreased. In other words, there’s decay dependent on frequency.
This isn’t the full story, but does indicate that high frequencies lose energy to the air faster. There are other sources of energy decay though, like loss in the sound board of the instrument.
Other complexities arise, like the coupling between strings. Take an A4, which has three strings. If all three strings are tuned to the exact same frequency, the decay rate will be three times faster than a single string. However in practice the strings are tuned very slightly differently, creating beats in higher order partials. If one partial decays faster than others, because of coupling, it transfers energy into the others. Thus the note is sustained much longer. As you move along the piano, from lowest to highest, some notes have one string, some two and the majority have three. There will be kinks in the decay pattern as you transition across these regions.
The diagram below comes from the paper http://matthiasmauch.de/_pdf/cheng2015modelling.pdf and does a good job explaining how piano notes decay depending on their frequencies.
To explain the graph, the x-axis is frequency (given in midi note index. To give you a sense of conversion, MIDI 57 = A3 (220Hz) and MIDI 69 = A4 (440hz)). The lower you go on the y-axis, the faster the decay.
Clearly, as you move right the data points start moving down (the higher the frequency the faster the decay). But there’s not a smooth curve; there’s a cloud of points. So, if you take any one point on the x-axis, let’s say MIDI 69. There is a spread of y values, i.e. different decay rates. There’s also a spread of grayscale, which means that this frequency will decay at lots of different rates depending on the how high order a partial it is!
I know it’s not a terribly satisfactory answer, but the underlying physics is sufficiently complex that a satisfactory answer doesn’t quite exist. The gist is: usually higher frequencies decay faster, but not always, and there are complicated reasons why!
The higher the string, the shorter and thinner. The lower the string, the longer and thicker. The lower strings have more mass and do not let go of the vibrations as quickly as the higher strings. Additionally, the lower strings have more harmonics and more opportunity to resonate with other strings in the piano, which adds to the sustain. If you need more detail, you will probably need to find it in a physics text.
Aside from the increasing momentum of lower pitch strings, note that the damping force is practically the same for all strings during free vibration. So the loss rate of energy is the same for any string. This makes lower pitch strings take longer time to consume their energy.
One can design a special instrument that gradually increases the damping force as the note goes lower so that the sustain times become equal. However in this special case, still the damping force of the resonating amplifier body (for example the wood board of a guitar or piano, as well as the room around the instrument) would stay the same and provide slightly longer su