There is no requirement that a keyboard be removed from your luggage. But, there is also certainly no prohibition against removing it from your luggage and sticking it in one of those bins.
Either way, if the item randomly or because of its configuration alarms and you are sent to secondary, unless you are at some checkpoint which is terribly backed up, allow an extra 2 minutes to have the item swabbed.