There are two types of keyboard loggers, software or hardware based. The hardware based ones are the hardest to detect, because they can be hidden inside the keyboard itself.
There is one trick that you can use to help protect your password. What you need to do is add extra characters to the passwords you type. Then highlight the extra characters you added, and delete them before you press a button to submit the password. This can prevent your password from being properly recorded.
Note: beware of copying your password to the clipboard, some keyboard loggers can capture this information.
Here is an example:
This is the real password without the extra characters: