If there is a metal plate inside, it's probably male. If there are 2 metal plates, it's a full-grown adult male.
All clicky keyboards are male.
If case and backboard are all plastic, it is probably female.
All wireless keyboards are female, unless it is something like a Model M that has been modded to be wireless.
Most rubber dome keyboards are female, although a metal plate may indicate butchness (this can be offset by a sensuous enough cloud ....).
If it is less than 2 of your fingers thick, or weighs less than 2 bottles of your favorite beer, it may not have reached puberty yet.
I agree that keyboards can also be gay or hermaphroditic.