Poor posture and muscle imbalances can lead to neck pain. The most common muscle imbalance I see is due to poor posture. Weakness is in the deep neck flexor muscles in the front of the neck and tightness in the muscles in the back of the neck.
Do this exercise to strengthen the front of your neck and help with correcting posture and muscle imbalances.