How to determine the polarity of a lamp?
The shell of the bulb socket (i.e. the part with the threads on it) should be neutral. There are many ways it's possible for you to be on contact with the shell: 


while handling a fixture, i.e. to keep it from falling or to steady it 
while screwing in a bulb
using cheap LED bulbs with metallic heat sinks (many of them either bond the heat-sink to the screw-base shell, or the insulation is so thin it could easily breach there.)  


All of this is for nought, if your lamp does not have a polarized plug: note the extra-wide blade on one side in this photo.  This keys it, to make it impossible to insert wrong in a NEMA 5-15, 5-20 or 1-15 socket. 



If it doesn't, you should get a polarized plug or cord with plug.   On a cord with a pre-molded plug, there will usually be ribbing or marking, and that should be on the neutral side, which is the extra-wide blade.  

The ribbing is meaningless on a user-attached plug, or non-polarized plug. 

To be sure, either


measure with an ohmmeter (zero ohms from shell to the wide blade on the lamp's plug, infinity to tip in all switch positions) 
measure with a voltmeter, with lamp plugged in, from the shell to holes on a nearby receptacle - near 0V to ground (that could also mean a bad connection) and 120V away from hot (sure, but more dangerous to measure). 
dismantle the lamp and visually follow the wire, noting the rib/marking on the wire. Check the plug to make sure the rib/mark does indeed go to the wide blade. 


Lamp cords with pre-molded plugs can be readily had from a proper electrical supply, McMaster-Carr, or by hacking an extension cord of appropriate gauge (typically 18 AWG unless it's one heck of a lamp). Use cords that are white, translucent yellow, brown or black - avoid obvious "I hacked an extension cord" colors like dark green.