If the horse has genuine headshaking, with the tics/fits and is caused by some disease, that is definitely more of a struggle, and I have no advice on how to handle that.
If the headshaking this horse does is a learned behavior (thus, not caused by a disease) such as my gelding does, then it will take a lot of work to convince him to stop. He will never unlearn the behavior, but perhaps he will learn when not to do it. He does a giant horse nod whenever I want to do something like worm, put on his bridle, make him stop eating grass and go back in the barn, etc. It is annoying and he has learned that if he does it enough, people will leave him alone.
Some of his shaking is pain related, as he sometimes hits his pole on the hay manger. So he gets a bump and doesn’t like the pressure of the headstall when we work. This might be another thing to look at and rule out.
Again, his headshaking is a learned behavior that developed because he knew he could get away with it, people would leave him alone, they would stop riding. He does not have actual headshaking caused by a disease. I love him dearly and he is the biggest horse project I have undertaken. Yes, he has freaked me out before, but I like working with him. What you would get into is a lot of work, you will lose your patience, and probably fall off sometimes. But despite his vice, I would buy my horse again. I fall in love with him all over again when we work.