Keyboard instruments are musical instruments in which the sound is produced by playing a keyboard.
To understand how they work, imagine the keys like a seesaw. When the key is played, immediately the other extremity moves up and puts into action the mechanism that produces sound. There are many kinds of mechanisms able to produce sound from keys, so there are different keyboard instruments like the piano, the harpsichord and the organ, among others.
The first keyboards were created in the third century b.C., they were hydraulic organs at the Greco-Roman civilization era, but only became important in the occidental civilization.
The earlier instruments had both different keyboards and techniques to play. They had only the keys that today we call "white" and the musician did not use the fingers, but the wrists. The "black" keys gradually emerged from 12th century, and only at beggining 15th century the keyboard became like we know nowadays.