How to allow setting hotkey in add-on
An operator represents an action or task that can be performed in blender. A button is blender's GUI representation of an operator which allows the user to initiate the action, while a keyboard shortcut is a non-gui method of executing an operator. Keyboard shortcuts can be edited in the user preferences and each belongs to a group that (should) represent the context that it is available. For example, the loop cut operator can be found in the 3DView/Mesh group so is available when editing mesh objects.

When right clicking on a button, the "Change Shortcut" and "Remove Shortcut" menu items are available if the button's operator has a shortcut assigned to it. See interface_handler.c

The "Add Shortcut" menu item, represents blender having some idea of what group the shortcut should be added to. Blender "guesses" the group based on the operator's bl_idname property and the menu option is only available if a valid group can be guessed from the operator's name. See wm_keymap.c where you will find the available group names that can be used. The group names used there are the uppercase version of the first part of the bl_idname of the operator with the _OT part being optional. For example giving your operator bl_idname='screen.my_operator' will enable the add shortcut menu item which will add a shortcut that will be found under "Screen" group in the shortcut settings.