I wouldn't go to a particular residency soley because you want to get into their Pain fellowship program. Research will definitely help your application, but it certainly isn't a necessity. My limited observation has been that Anesthesia residents from MGH, BWH, BIDMC, UCSF, Stanford, Hopkins, Columbia, and UCLA have little difficulty in terms of obtaining a fellowship. Often, these residents wind up staying at their home institution (except for Columbia residents).
I think that spending your elective at the program you want to go to is extremely helpful. If this isn't possible, then spend your elective time at your home institution's program and try to get a solid letter. If you know you want to do Pain, it's worth the investment to buy 1-2 books as a resident so you can show off your skills. At the minimum, you should look at some fluoro images and learn where the needle should go for TFESIs, ILESIs, and MBBs. Also, learn how to do a good MSK exam before your rotation because that's something that most Anesthesia residents haven't had to do in a long time.
There's much more people applying to Pain these days. At least at the Harvard programs, there are lots of applications from BWH, MGH, and BIDMC.