most of that is just hollywood. The Movies "The Exorcist" which spawned much of those concepts was based on the exorcism of Roland Doe in the 1940s. In more recent years, "The exocism of Emily Rose" was based on Anneliesse Michel in the 1970s.
In the case of Roland Doe, he was more likely suffering from psychotic disorders which were interpeted by the family and priest as demonic possession. He didn't really do anything fantastic, but non-the-less he inspired a hit film.
The case of Anneliesse Michel is even darker. The girl was mostly being abused by the family and the priest. Most of the information that inspired the movie comes from a court case in which the family and priest tried to cover the murder of Anneliesse by claiming that she was possessed. It was a double edge sword for the court. A guilty verdict would turn them against the much beloved church, and a non-guilty verdict would condone the church's behavior. They went with guilty, but issued extremely light charges. Again, no real head spinning, or walking on ceilings. All of that was just part of the hollywood effects.
Some of the inspiration hollywood draws from was the medieval treatment of mental disorders. People with depression, schizophrenia, OCD, or split personality could be considered possessed by demons, a danger to society and locked up. They would be treated worse than animals in the facilities where they would likely spend the rest of their lives. If they weren't crazy when they were put into such a facility, they would surely lose their sanity quickly.