I'm currently taking a research year between 3rd and 4th year. Here's my opinion on the matter.
Most people take research years between M2 and M3 or between M3 and M4.
The advantage of doing it M2-M3 is that you will have plenty of time afterwards for your research to be submitted and published by the time you apply for residency, which makes your application look better. M3 is so unlike anything that you've done before that most people will expect you to suck when you first arrive anyway, and most people will understand. You will be reading about your patients and studying for shelf exams anyway, so I don't think it will be a big deal to come back after a year. In addition, most people schedule the rotations that they're not very interested in first so that they have a warm-up period before having to try and impress the people in the fields that they're interested in going into.
The advantage for doing it M3-M4 is that by the end of M3, you will have a pretty solid idea of what you want to specialize in. As a result, you can choose a PI in the field you want to go into, giving you a good chance to get to know the right faculty that will help you with LORs, application advice, etc. The disadvantage is that most people do their sub-is early in the year, so you may be rusty when you have to go and start your sub-i.