Think of your desktop as running a variety of programs always, even if they have no windows, terminals, or show up as daemons. Most are running a window manager, perhaps various toolbars, a desktop, and so forth.
Now let's see what happens when a key is pressed. The key press and key release are treated separately, though a library may deal with combining them for the programmer. The keyboard driver handles some things, such as treating the Shift key as a modifier rather than a discrete key. The driver itself may capture some key combinations for its own use, or it can throw it to a program.
Which program gets it? Programs with windows, as a standard, only get notified of keystrokes when they have input focus. A program can also "grab" certain keys for its own use. Alt+Tab is grabbed by Unity, denying any other program seeing it. Ctrl+T is grabbed by Firefox's menu system, but only when a Firefox window with a menu that wants to know about it has input focus.
So who determines who gets what? Besides input focus, as I already mentioned, it's often first-come, first-grabbed. Alt+Tab gets grabbed by Unity (and many other window managers), so a user program can rarely snatch it away. An end-user is at the mercy of the programs in use; if a program, such as
vim, allows you to configure certain key combinations for various things, then you're good to go, as long as the program gets the keystroke.