I don't know how people decide, I think a lot of it is on a gut feeling. I took a year off between years 2-3 of med school and did a fellowship in anatomic pathology. Thus, for an entire year I acted as a pathology resident. It still took about 3-4 months for me to become familiar enough with pathology to be certain that it was what I wanted to do. Otherwise, I may have just fallen back on IM because I just assumed that was what I wanted to do. Obviously I don't suggest doing a full year in a specialty to decide if that is what you want to do, but spend as much time as you can in the environment, because it is very difficult to understand what it will actually be like until you live it. If I had to decide on OB/GYN based on my 6 week experience, that would be very tough.
I have seen people in my class change their minds a lot, up until the fall of 4th year when you sort of have to decide. I don't know what the numbers are, but there is a certain percentage of people who change fields after experiencing part of their intern year.
THere are always those who are convinced that they will end up in a certain field (usually it is highly specialized, like pediatric endocrinology or whatever). To be sure, some of these folks do indeed have tunnel vision and end up doing that, but a larger percentage probably change their minds a few times before finally settling on a choice.
Personally, I have not second guessed my specialty (pathology) of choice since about midway through my third year, after I gave myself enough clinical blocks to know if I could pass up doing IM. No doubts now, but a lot of this is probably due to the amount of time I have spent in my field already.