Actually, for most body tissue, 3 to 6 hours of complete loss of blood flow causes no lasting damage. Necrosis should not set in for quite a while, actually. IIRC some tissues can be completely without blood flow for up to 24 horus without adverse effect (I know muscle and skin seem to be the longer ones, can't remember the exact times, though). Heart, brain, and certain other organs do have a drastically shorter lifespan without blood flow, however.
It is a reduction of circulation...it is not that difficult to impair blood flow, and in some cases cut it off altogether in major arteries. For arms, one typically cuts off the brachial artery (which lies under the upper arm, and is close to the surface from the armpit about halfway down to the elbow). Lying with your head on your arm, arm under the pillow, arm lying over somthing, etc can all cut off or reduce the flow enough for this pins and needles sensation. Even having the arm in the wrong position can cause the muscles, tendons, etc to put enough pressure on the artery to reduce blood flow. It doesn't have to be stopped, just reduced.
What happens is that the blood flow is reduced enough that nerve cells in the arm stop working (think of it as going dormant). The nerve signals your sending to the arm don't reach the muscles, which are also suffering from lack of blood, and your arm doesn't work. As you move enough to allow blood back into the extremity, the nerve cells start "waking up", and will generally send signals back as their chemicals get back into the right place and they try to get straigtened out. The pins and needles sensation is just the millions of nerve cells in the arm waking up and getting themselves sorted out.
That's a laymans answer. I'm a medic (have been for 13 years now), so I am somewhat educated on the subject. I'm sure a doctor could go into more detail, and some of the minor details could be wrong. However, Fade, it is actually caused by loss of circulation...it doesn't have to be completely cut off, just reduced enough that cells don't get the oxygen they need for full function.
Okay, found a few links.
http://www.bbc.co.uk/health/ask_doctor/pins_needles.shtml
http://www.chw.healthinkonline.com/modules/SelfCareWellness/vitWellness.asp?wellID=58
Apparantly, I need to add to my answer

Nerve damage can also cause the sensation, although typically this is referring to longer term pins and needles sensations. From sleeping it's generally circulation loss.