Neck pain typically occurs when the spine and muscles of the neck become strained. Posture and head position are the cause. Did you know that your ears are supposed to line up with your shoulders? For every inch forward your head migrates its like adding a 60 pound weight on your back. The body compensates by tying to use the muscles in the back of the head and neck to pull your head back. This leads to joints that are locked and muscles that muscles that spasm.
The answer to restoring the proper posture is activating the muscles to engage the deep muscles in the front of the neck (supine chin tuck) and the muscles in the lower shoulder (scapular retraction).