This is quite a complex matter. I will explain it in a couple of steps.
1. Intervals beat
When two keys are pressed at the same time (this is called an interval), a piano will produce a combined sound. If you listen closely you will hear that this combined sound beats. The volume increases and decreases a few times per second (some intervals beat slower).
2. Each interval has to beat at the right speed
Each interval on a piano's keyboard beats at a different rate. The rates of the beats for each interval are important. A piano will only sound good if these beats are exactly right. There are quite some rules that these beats have to respect. A major third beats faster than a fifth. An octave only beats very slowly. Also, if you play a major third somewhere on the keyboard, it will beat faster when you play it on a higher pitch (more to the right).
3. The beats are produced by higher harmonics
Okay, the interval's beats are important but where do they come from? Well, if two tones with almost the same pitch (but different) sound together they will produce a beat. Let's say tone A has pitch FA and tone B has pitch FB. When FB is only a little higher than FA together they will produce a beat with frequency F = FB - FA.
This is getting quite technical and not so important. But if you like, you can study the animation below to understand this principle.
So, two tones with pitches that are close to each other produce a beat. That's good to know but the two tones of an interval are not close at all! The pitch ratio of a major third (in just intonation), for example, is 1.25. These two pitches are far apart. They will never beat! What is it that's producing the beat then?
The answer lies in the higher harmonics that vibrating strings produce. When a string is struck, it will produce many tones at the same time. It will vibrate at its fundamental (the lowest) pitch, but it will also vibrate at a frequency of 2, 3, 4, etc. times its fundamental frequency. The cause for this is that a string can vibrate in several ways. It can vibrate in one whole section; the middle of the string then oscillates and the ends are fixed. It can vibrate in two sections; the middle and the ends are then fixed and the string oscillates on 1/4 and on 3/4 of the length. This way a string can also vibrate in three, four, five... etc. sections. All these vibrations occur at the same time in the string. The animation below clarifies this. The sections are also called parts which is the reason that higher harmonics produced by strings are also called partials.
Now we can understand what is causing the beats in, for example, a major third. The interval from A4 to C#5 is a major third. If the A4 has a pitch of 440 Hz then the C#5 (in just intonation) has a pitch of 550 Hz. The fourth harmonic of the A4 (5 * 440 = 2200 Hz) is the same as the third harmonic of the C#5 (4 * 550 = 2200 Hz). So one of the beats that you hear in a major third is caused by these two higher harmonics. You actually can hear multiple beats caused by multiple pairs of different harmonics. You can imagine how hard it is to hear (and count) these beats by ear. Professional tuners practice years to get it right.
In the previous section I explained that a string vibrates in different parts. This causes the higher harmonics (partials) to be produced. I talked about frequencies of 2, 3, 4, etc. times the fundamental frequency. That is actually not exactly the truth. Because of the physical properties of a string (length, diameter, stiffness, weight, imperfections, etc.) these factors are a little higher. A string needs to stretch a little in order to vibrate. A string needs to stretch even more to vibrate in more parts. That is one of the reasons why a higher harmonic frequency, in real life, has a higher pitch than you might expect.
All of the above means that the beat rate of an interval is dependent on the (huge amount of) physical properties of the piano. These properties are different for each piano. In order to get the beats of all intervals exactly right each piano needs to be tuned differently.
6. Dirk's Piano Tuning Software solves the puzzle
It is an extremely complex puzzle to determine the right pitch for each string so each interval will beat exactly right and the piano will sound optimal. Dirk's Piano Tuner solves this puzzle for you. In Dirk's Piano Tuner all strings will be recorded by playing them all one by one, only one string per note the remaining strings muted. The necessary tuning is determined by the computer using these single string recordings. The tuner not only records the fundamentals, but also the harmonics. After this 'single string' recording, the tuner has all the data needed to calculate the optimum base setting of all strings. The tuner calculates then the purity of all possible intervals and aligns them. After this the strings can now be tuned one by one to the resulting notes from the tuner.