The keyboard is quite an effective way to tell the computer what you have to "say". The keys themselves, much like on a typewriter, have places that each will go to. There are usually pads that 'short' a connection in the keyboard, which sends an electrical signal to the I/O (Input & Output) of the computer. The I/O can tell by the signal which button (or buttons) have been pressed, and it goes on to tell the processor (the 'brain'). The processor looks at the program that you have open (Word, for example), and tells the program what the buttons are that were pressed.
For example, if I type the letter "q" (lowercase q), the keyboard shorts out the point that is assigned to the "Qq" key. Because the Shift key isn't pressed, and the Caps Lock isn't on, the I/O knows that the code for "q" is 113 (in ASCII, one of the many types of codes for letters, numbers, and symbols). Computers don't work in the number system we do though, so it calls the number 113 as 0111 0001, which is binary (0s and 1s only).
Once it finds the code '0111 0001' from the keyboard, it sends the code to the processor, along with some information about the keyboard, how long the button was pressed, etc., and the processor takes it in. It then uses that code to control or encode (put into digital information) the data, and changes the code from the keyboard to make it work with the program (ASCII to UTF-8, for example). In Microsoft Word, for example, the letter is then displayed on your screen, and what you have typed is stored in RAM (Random Access Memory, the short-term memory of the computer). When you save the document, the information in the RAM is taken out and stored in the Hard Drive in whatever way the program is set to do so.
In short, the I/O picks up the keypress, converts it, and sends it to the processor. The processor reads the program to find out what to do with the information it received, whether that means to store it in RAM and put it on your screen, save it to the Hard Drive, or even control your favorite video game!