How does a compressor increase sustain?
With a typical comp, there are two components: one that provides gain reduction, and one that provides "make-up gain". The gain reduction element is what drops the level of your signal as it crosses the threshold. Since the peaks are reduced, and since what our ears/brains actually hear is the average levels (averaged between the quietest and loudest moments), that means when the peaks are reduced, the average is reduced too, and the signal sounds quieter to us. So the second element, "make-up gain", is a simple clean boost of the overall signal level to bring the average levels back up to the level they were at before compression.
So now the average levels are back to normal, but the dynamic range has been reduced, so the net result is that the noise floor (and the "floor" of lower-level signal from your instrument) has gotten louder. Anything that was previously quieter, has now been turned up by the amount of make-up gain you applied. For instance, as your notes trail off, they naturally get quieter; but now that trailing-off happens at a much shallower slope than before, because it has less distance to go, from high to low level. So your notes last longer--more sustain. It's just because you are turning up the volume of the whole signal, while turning down the level of the peaks.
The higher the ratio =
the more the peaks are compressed (reduced in output level) =
the narrower the dynamic range (from loudest to quietest sound) =
the shallower the slope as your note trails away =
the more your note stays "near" its peak level while decaying (increased sustain).
The lower the threshold, the more of your signal gets compressed--again reducing the dynamic range, etc.
What makes one comp better than another for increasing sustain is a combination of those two elements, plus (ideally) having low noise. Since the noise floor of your signal is usually increased to about the same degree that you increase the sustain, any extra noise from the comp becomes especially noticeable. There are a few comps that minimize this problem by skillful and crafty engineering; and there are a few that manage to increase the noise much more than you'd expect, or where they actually introduce their own operating noise. Bear these extreme cases in mind, when trying out any sustainer.
One really good trick is to use a compressor that has a clean blend function, or any regular comp mixed in parallel with the uncompressed original signal. That way you can set the compressor for an extreme smashing function with a high ratio and low threshold, giving you maximum sustain; while the uncompressed channel (clean blend) retains some of your dynamics and upper harmonic tone.