First, unless you plan to fabricate your own key mechanism, you'll have to obtain the cheapest toy keyboard you can find. Here's a picture of the one I used (actually it's a picture of the box since I've already gutted it at the time of writing):
Looks good eh? It cost £5. Unfortunately none of those buttons does anything useful. Never mind. Let's look at the guts:
This picture is from a different, yet highly similar toy keyboard which cost me £1. The first thing you'll notice is the resistor ladder:
This is a string of resistors wired in series, with a sheet of metal cut like a comb to form the actual key contacts. This varies the resistance across a simple RC oscillator circuit when keys are pressed, thus varying the pitch produced.
As you might guess, you can only get monophonic sound from this thing. Also, the poor tolerances of the resistors used and inherent instability of the RC circuit mean that the keyboard does not even produce a correct 1 octave step between each group of keys. Needless to say, it sounds terrible. We won't be using any of the electronics at all, so you can chuck it all into your spare parts box. Keep the plastic spacer and metal comb.