There are several types of keyboard, usually differentiated by switch technology. Since there are so many switches needed (usually about 80-110) and because they have to be highly reliable, this usually defines the keyboard. The choice of switch technology affects key response (the positive feedback that a key has been pressed) and travel (the distance needed to push the key to reliably enter a character). Newer models use hybrids of various technologies to achieve greater cost savings.
Membrane keyboards are usually flat. You would most probably see them on appliances like microwave ovens or photocopiers. A common design consists of three layers. The top layer (and the one the user touches) has the labels printed on its front and conductive stripes printed on the back. Under it is a spacer layer, which holds the front and back layer apart so that they don't normally make electrical contact. The back layer has conductive stripes printed perpendicularly to those of the front layer.
When placed together, the stripes form a grid. When the user pushes down at a particular position, his finger pushes the front layer down through the spacer layer to close a circuit at one of the intersections of the grid. This indicates to the computer or keyboard control processor that a particular button has been pressed.
Membrane keyboards don't generally have much of a "feel", so many machines which use them issue a beep or flash a light when the key is pressed. They are often used in harsh environments where water or leak proofing is desirable. Although used in the early days of the personal computer (on the ZX80, ZX81 and Atari 400), they have been supplanted by the more tactile dome and mechanical switch keyboards.
Mechanical switch keyboards use real switches, one under each key. Depending on the construction of the switch, these keyboards have varying responses and travels. The best tend to approximate the old IBM Selectric electric typewriter keyboard, which was considered the benchmark for good performance for many years. Because of the expense of placing a switch at each key position, these have fallen out of favour in recent years, despite their excellent response. Most IBM keyboards up into the PS/2 line were of this type, and considered to be among the best of breed, although some complained that they were "clackity."
Hall effect keyboards used magnets and "Hall Effect" sensors instead of an actual switch. When a key was depressed, it moved a magnet, the motion of which would be detected by a sensor. These keyboards were fairly quiet and considered suitable for industrial environments. Because a magnet a sensor was required for each key, as well as complicated control electronics, they were also ridiculously expensive. [I (Joshfuller) have never used a Hall Effect keyboard, please correct if needed.]
Dome switch keyboards are kind of a hybrid of membrane and mechanical keyboards. They bring two circuit board traces together under a plastic "dome" or bubble. The top of the bubble is coated in some conductive substance. When a key is pressed, it collapses the dome, which shorts out the two circuit traces and completes the connection to enter the character.
This is the predominant switch technology used in mass market keyboards today. It's considered much quieter, but purists tend to find it "mushy" because the collapsing dome doesn't provide as much positive response as a hard closing switch. These are also a good choice for office or consumer environments because they share a certain degree of liquid resistance with their membrane ancestors.
The modern PC keyboard is more than just the switch technology, however. It also includes a control processor and indicator lights to provide feedback to the user about what state the keyboard is in. Depending on the sophistication of the controller's programming, the keyboard may also offer other special features.
The processor is usually a single chip 80XX variant [I think - Joshfuller]. The keyboard switch matrix is wired to its inputs and it processes the incoming keystrokes and sends the results down a serial cable (the keyboard cord) to a reciever in the main computer box. It also controls the illumination of the "caps lock", "num lock" and "scroll lock" lights.
When you press a keyboard key, you may think that you do so in a continuous and smooth motion, making firm contact, and then releasing the key. However the key actually "bounces" against its contacts several times before it settles into firm contact. When released, it bounces some more until it reverts to the uncontacted state. If the computer was watching for each pulse, it would see many keystrokes for what you thought was just one.
To resolve this problem, the processor in your keyboard (or computer) "debounces" your keystrokes, by aggregating them across time to produce one "confirmed" keystroke that (usually) corresponds to what you think is a solid contact. It could be argued that the dome switch technology outlined above owes its popularity to the ability of the processor to accurately debounce the keystrokes. Early membrane keyboards limited typing speed because they had to do significant debouncing. Anyone who ever tried word processing on a ZX81 will recall this.