Hi onemite,
I would suggest that the people didn't always know what troubled the demoniacs, but that the narrative in scripture tells us what their problem was by revelation. We have an example of how this played out in Acts 16.
And it came to pass, as we went to prayer, a certain damsel possessed with a spirit of divination met us, which brought her masters much gain by soothsaying: The same followed Paul and us, and cried, saying, These men are the servants of the most high God, which shew unto us the way of salvation. And this did she many days. But Paul, being grieved, turned and said to the spirit, I command thee in the name of Jesus Christ to come out of her. And he came out the same hour. (Acts 16:16-18)
Here were are told first that the damsel was possessed, then we are told what happened. Paul was on his way to pray and was met by this woman. You will notice that what she said for 'many days' was accurate, "These men are the servants of the most high God, which shew unto us the way of salvation." I would suggest that Paul did not immediately know what was happened here. In fact, this went on for a while. But for some reason he was being grieved by what was said. There came a point when he either by revelation saw (discerned) that it was a demonic spirit or he finally had a green light from God to rebuke the spirit and cast it out. In either case I suggest that unless one knew she was a soothsayer they would have not picked up on the demon possession without spiritual discernment.
I don't see where there might have been any practice of casting out demons before Jesus and I wonder how it became known that they were dealing with demons.
Casting out demons goes back a ways. Josephus tells us about Solomon having special powers or a 'formula' to do it that required a certain plant root, but this is doubtful in my view. It was common in pagan societies to believe that certain 'formulas' of words, etc. could be used to effect the supernatural. When the people repented in Ephesus they burned a fortune in this type of stuff.
Dealing with the demonic is always on a 'need to know' basis. The subject arouses curiosity that is not healthy. But demons are real and they at times have to be dealt with.