A keylogger is a program that runs in your computers background secretly recording all your keystrokes. Once your keystrokes are logged, they are hidden away for later retrieval by the attacker.
The attacker then carefully reviews the information in hopes of finding passwords or other information that would prove useful to them. For example, a keylogger can easily obtain confidential emails and reveal them to any interested outside party willing to pay for the information. Keyloggers can be either software or hardware based.