<p>An example of an app that does this is <a href="http://www.humanized.com/enso/" rel="nofollow noreferrer">Enso</a>, it pops up when you press the caps lock.</p>

You need to install a hook in user32.dll. Lookup the Win32-API call SetWindowsHookEx. You can call it from C# via the stuff in System.Runtime.InteropServices.
This article
discusses the topic nicely.
Edit
: Lars Truijens answer looks like a nicer approach actually.