From the documentation, only processes running as root can access events prior to their entering the window server. Therefore, you have to have root access to listen to another user's keystrokes.
It still seems like a bit of a security hole, though, to allow any application to listen to any other application's keystrokes.
EDIT:
from the documentation:
Event taps receive key up and key down events if one of the following conditions is true:
•The current process is running as the root user.
•Access for assistive devices is enabled. In Mac OS X v10.4, you can enable this feature using System Preferences, Universal Access panel, Keyboard view.
Therefore, a user has to explicitly enable the ability to log keystrokes either by allowing the process to run as root or by enabling "Access for assistive devices," which is disabled by default. I guess that's how they mitigate the security hole.