Why do people get knots in their back?

I have a bunch of knots in my back and neck they cause alot of pain and trying to massage the knots make it more painful, do you guys have any tips?