As with so much in the realm of studying and study skills, I think finding an approach that works for you is going to be critically important. I am not entirely certain that any sort of "magic solution" exists. Individuals have to try different approaches that end up working for them. One thing that might help is to study in chunks and sections, as opposed to layers. For example, if you have to study a particular topic, segment the studying into different tasks or sections that need to be studied. Budget out time for completing those elements might help in a couple of ways. By allowing for breaks to be taken when one section is done and when the next needs to be resumed, it gives the mind a chance to rest and regroup, which would allow the unusual thoughts to be present, but not tradeoff with the studying. Additionally, segmenting what has to be done might also allow the task to be accomplished in a more worthwhile manner because it allows you to focus on incremental and steady progression, as opposed to a more vague and ambiguous approach that allows for unusual thoughts during studying to emerge.