A keylogger is a piece of software which records keystrokes, unbeknownst to the user. It is a kind of spyware.
Some keyloggers can record URLs of visited websites, emails that have been read or sent, which files have been opened, and even create a video which reproduces all activity on the computer!
Since keyloggers record all keystrokes, they can be used to steal the passwords of the workstation's users. This means that you must be particularly vigilant when you use a publicly accessible computer (like a freely accessible terminal in a place of business, school, or public place like an Internet cafe).
Keyloggers may be either software or hardware. For software, it may be a hidden process (or one with a name that looks a lot like the name of a real system process), which enters the information gathered into a hidden file. Keyloggers can also be hardware, in which case it's a device (cable or dongle) placed in between the computer's keyboard plug and the keyboard.
The best way to protect yourself from keyloggers is vigilance: