I'd find a way to take it after completing all of the core rotations, first and foremost. Medicine, surgery, peds, and psychiatry. Medicine represents the largest portion of the exam, there are a lot of surgical questions, and the test is littered with psych questions like identify somatization, differentiating adjustment disorder from MDD, etc. Frankly, I think any combination of those rotations will be useful, some more than others depending on your inherent strengths and weaknesses. (Like, if you know the psychiatry stuff and remember most of it from Step I you can brush up on it quickly.) But definitely include medicine, just because it seems to be the largest bank of questions for the exam.
I think ob/gyn would be crucial. It's a completely separate field of medicine that you haven't ever encountered before. There is a finite amount of knowledge and on an 8-week clerkship you will likely see everything.
Neuro is least important....many people do that as a fourth year rotation anyhow. I wouldn't worry a whole lot about that.
Family, surgery, and medicine all overlap a good bit. Medicine is probably the most bang for your buck for step 2 of those three. OB/GYN, psych, and peds are very different animals. Missing any of them would destroy you on those sections.
HOWEVER, lets say you didn't do family and surgery.....you still aren't going to be doing great on step 2. I guess it depends if your goal is to pass or do well.
Go based on the shelf exams. The surgery shelf is practically a medicine shelf with an odd smattering of peds and ob/gyn, very little true surgery (i.e. you might have to know what imaging to know and whether or not to proceed to surgery, but usually not the kind of surgery that would be done). Neuro has a lot of overlap with medicine, especially stroke and seizure. Psych has a limited overlap with medicine. Peds and ob/gyn have barely any overlap (at least exam-wise).
The medicine clerkship is an absolute must, as it accounts for probably 75% (my estimation) of step 2.
Ob/gyn, psych, and peds are niche fields that have limited overlap with medicine but will definitely show up on the exam and may be hard to "wing" if you haven't done their respective clerkships.