Your ERAS application can be submitted as early as Sept 1. It's specialty dependent, but it's not uncommon to start getting interviews within a week of submitting your application. The early bird gets the worm -- most interview offers I received were between Sept 7 and November 15 (two weeks after the deadline of most of my programs).
My best guess is that if you want Step 2 included in your initial application, you would need to take the exam sometime in late july or first day of august and allow 3-4 weeks (check the NBME web site for score turnarounds) for the score to come back before Sept 1.
However, if your score doesn't come back until after you've submitted your application on Sept 1, you can login to ERAS again and transmit the new Step 2 score to programs at no additional cost. If your score goes in before the Dean's letter is uploaded by your school on Nov 1, the residency program will still look at it anyway. However, if you have a weak Step 1, I wouldn't wait until Nov 1 to tell them your new and improved Step 2 score -- take it earlier in that case.
The test isn't really that bad and you don't need nearly as much time to study for it as for step one -- 2 weeks (6 hours daily) of cramming Crush Step 2 and Kaplan Qbook questions earned me exactly the same score as my step one. If you need a higher score than your original score, just go upward from the "Step 2, 2 weeks, #2 pencil" rule.