I don't know a darn thing about Scottish witchcraft trials but I am fairly well versed in the Salem witchcraft trials.
Current medical opinion is that the 'afflicted' were either suffering from hysterical delusions - or possibly ergotism or some other actual illness which produces delusions. Whatever the cause there is no question that the 'afflicted girl's' behavior was *extremely convincing* convincing enough to shake even accused confident of their innocence - much less the judges.
When a girl rolls around on the ground screaming she's being pinched and bitten by the phantom of the accused witch - and you see pinch and bite marks on her skin - it's not surprising that you'd believe in 'spectral evidence'. And if another goes into convulsions with movements so violent you fear she's going to break her limbs it's very hard not to believe some exterior force isn't doing this to her.
Nowadays we'd look to psychiatry - or maybe parapsychology - for an explanation and a cure. In the 17th c. there was an answer convenient to hand; witchcraft!