In its simplest form, a keylogger trojan is malicious, surreptitious software that monitors your keystrokes, logging them to a file and sending them off to remote attackers. Some keyloggers are sold as commercial software - the type a parent might use to record their children's online activities or a suspicious spouse might install to keep tabs on their partner.
Keyloggers may record all keystrokes, or they may be sophisticated enough to monitor for specific activity - like opening a web browser pointing to your online banking site. When the desired behavior is observed, the keylogger goes into record mode, capturing your login username and password.
Some sites attempt to thwart keyloggers by having the user respond to visual cues they must point to with their mouse instead of using their keyboard. However, some keylogger trojans also capture screenshots, thereby negating the effect of this strategy.
Keyloggers and other forms of remote-access trojans tend to be the most determined malware, taking extra steps to stealth its presence, including through the use of rootkits.
The best defense against keyloggers is prevention. One of the most common infection sources is peer-to-peer (P2P) filesharing networks, such as Kazaa, Morpheus, Gnutella, and dozens of others. Keyloggers are also commonly sent as email attachments and via links in instant messages that point to the infected file.
Too often, people are lulled into a false sense of security, believing, for example, that if they simply switch to a different browser they will be safe from harm. It's simply not so simple. To stay safe means becoming proactively engaged in your own security. Here's a good place to start.