Have pain in my shoulders, elbows, hips, and knees. Usually pain accompanied by severe headaches and muscle pains and spasms. What is pain and why?

Polyarthralgia. Polyarthralgia or pain in multiple joint could be seen in many rheumatological conditions. Headaches and muscle spasm may or may not be associated. You need to contact your physician for proper diagnosis and treatment. Possibilities may include lupus, juvenile rheumatoid arthritis, lyme's disease, polymyalgia rheumatica. Hope you feel better soon.