macro uses higher f numbers (more stuff is in focus). portraiture uses smaller f numbers to get a blurrier background.
100mm vs 50mm is a matter of how close you need to be to get max magnification. compare their minimum focus distance specs. keep in mind that the measurement does not start from the end of the lens; it generally starts from the back of the lens or the sensor (i forget which). if your mfd is too short, you risk blocking your light source.
generally, people prefer 100mm for macros, but for keyboards, i personally say it's an unnecessary expense. the more important part is to get a tripod.
settings for macro photos look like:
low iso (100 pref) so we don't lose detail to noise
high aperature (generally f11 - f16, although f22 is fine too. but you need to read up what aperature your lens begins showing diffraction and stay below that. smaller f-number is also fine if you want to blur the parts of the board that are further away)
low shutter speed (because you have a low iso and a high aperature, your pic will be dark. you need a low shutter to brighten the pic up. this is why you should get a cheapo tripod )