This is probably one of the first things they told me when I started to run in Club Marathon some 20 years ago. By then my coach, was a devoted runner, probably with not all the modern techniques with him but with incredible experience and know how.
Arms swing and position is very relevant for long distance runners. I recall an impact of 7% but no clue where this number comes from. Let´s say it can be relevant to achieve specific targets.
Swing is supposed to be in compass with the legs but the key thing is that we should not exaggerate the swing as we will be losing energy. On the other hand we should not, as many people do specially when tired, press their arms to their body. (as in the picture) This is good for some sports as preventing direct contact with their chess in hits but not for running.
Arms position should try to keep 90º between arms (I found it too much but I would no consider less than 80º)
Hands position should be in line with forearm and fingers relaxed. I tend to do a yoga position style which probably is not perfect but allows me to relax all the way. I usually position the thumb on top of the other fingers. I usually tend to close a bit more the fingers than in the picture but leaving enough space for the fingers to breathe.
If your shoulder hurts after/during a long run it is usually (or at least for me) due to work stress or position when sitting more than running. It is good to stretch and to combine some exercises (push-ups. arms circles etc.) Also consider check the position of the rest of the body (hips, back) and lateral misalignment.
I found interesting the site:
http://www.runaddicts.net/tips-tricks/the-importance-of-a-proper-arm-swing