My neck hurts when I lean it back to look up like at ceiling?

Facet arthrits. Facet arthritis or just letting you know not to stay in this position or don't lean back farther this can be normal for many humans your end range of motion all joints let you know the comfortable end range of motion fingers shoulders why would your neck be any different.
Several poss. causes. Looking up (neck extension) pain can have many common causes. Some are more permanent, such as arthritis or disc degeneration, but very often, especially if it is acute, the cause is functional. Malfunctioning muscles and vertebrae-not just in the neck, itself, but in the upper back and even in the ribs can interfere with neck function. Osteopathic manipulative treatment can often correct this.