Just like any other instrument, a piano has to be in tune in order for it to make beautiful music. The pitch of each piano key may just be a sound that you hear, but there is a lot of math that goes into making all the notes hit the right sound.
There are 88 keys on a normal piano, each key being a half note apart. When you press each key, a small hammer hits the string, causing the string to vibrate. Each string has a different frequency of vibration, which leads to the different pitches. These vibrations are measured in hertz, or how many times it vibrates in a second. A few examples of the frequencies of C in different octaves:
You may have noticed in the different octaves the similarities between the numbers. These are similar to ratios, each time you go an octave higher, the frequency will double. For example, middle C is about 262Hz, if you multiply that by 2, you will get 524Hz, which is pretty close to the frequency of C5. Below are the ratios between different chords on a piano:
This type of tuning is called Pythagorean tuning and originated from the Greeks. They hadn't yet discovered frequencies and how they worked, but they were able to tune their instruments using math and these simple ratios.