So in cases like valproate for migraine, those drugs usually stay off-label long term. That makes them unattractive for doctors to prescribe, since they assume more liability if something goes wrong, and insurance companies are less likely to cover the drugs.
The way information about off-label uses gets communicated is basically the same way as elsewhere in science: through scientific papers, conferences, textbooks, and the like. A doctor who discovers that their migraine patient does well on valproate might publish this as a case report. If there are many such reports, someone might do a randomized trial. Once there are many randomized trials, meta-analyses can be performed, and eventually, the information will end up in textbooks and medical school curricula.
It takes a certain amount of agency for a doctor to stay up to date on the latest research; while medical boards tend to have certification requirements for CME (continuing medical education), these are usually quite lax, and a truly lazy doctor can probably just live their years without really learning anything new.
At the same time, reading all new research that comes out is basically impossible, and even just trying to do this would risk always following the latest fads that later evidence might show to, in fact, be harmful. Every doctor needs to find their own middle ground here, and you as a patient must find a doctor that suits your own preferences.