MIDI, or Musical Instrument Digital Interface, is a technology that allows a controller device like a keyboard to send data messages to a device (such as a PC or a MIDI sound module) that translates the messages into notes from an infinite number of virtual instruments. If you have a MIDI keyboard with an on-board interface and memory, you can send the data files from an external device into your keyboard as well, allowing you to keep sequenced tracks, such as drum tracks, ready to use later.
Plug your MIDI keyboard into its AC adapter, or to a PC using USB power. Plugging it into its own power source is the better choice here, because you will eventually be disconnecting your keyboard.
Plug MIDI cables into both the "MIDI In" and "MIDI Out" ports on your device; or, alternatively, plug in your device using USB or FireWire if it is so equipped. The idea is that your MIDI device needs to be able to share data in both directions with your PC or external MIDI module, and MIDI cables only send data one way at a time.
Turn on your keyboard and your other device. If your MIDI keyboard is one of any quality, it will have on-board RAM (random access memory) to save MIDI sequences temporarily, as well as a small hard drive. You can accomplish some neat tricks by dumping either ".mid" files, which are single sequences, or ".syx" files, which are dumped versions of the entire contents of your MIDI keyboard's RAM. Both will allow you to play back and work on sequenced MIDI tracks -- either those you have created yourself or ones that can be downloaded from websites created for translating popular tunes into MIDI.
Connect your MIDI keyboard to your PC, using the USB cable if your keyboard is so equipped. If you do not have a USB-equipped keyboard, you will need a MIDI-to-USB device, one with support for both input and output of MIDI messages. Once you are all connected, transferring ".mid" or ."syx" files to your MIDI keyboard is as simple as dragging and dropping through your Windows or Mac OS operating system.
Note that the type of files your keyboard can read varies a bit, depending on the manufacturer. Though almost all MIDI keyboard devices can transmit MIDI messages to be used by other devices, some digital keyboards, such as those made by Roland, use their own type of file to save data. You will need to modify your techniques accordingly. Consult the manual for your specific device, or contact the manufacturer if you are not sure.