1. Know your chances
The most important determinant of your chances of matching into a fellowship is where you are doing your residency. If you are doing Residency in a big University program whose residents are known to match in their specialty of choice most of the time, then you really don't have to do additional work to match into fellowship. However, if you are in a small community program which doesn't have a local fellowship, or has one but doesn't take its' own and you are applying for a high stakes fellowship e.g. Cardiology, GI, then your chances are slim.
Most people are somewhere in between those two extremes.
Regardless, the above shouldn't dissuade you from doing your best and excelling, but will determine how much you need to work on your plan B.
2. Know the dynamics of selection to fellowship in your program if it has the fellowship in house.
In other words, as an IMG in a community program your best chances of matching in fellowship is in your own hospital. From Day 1 in Residency find out how the decision is made in selection. It varies from program to program. In some it is an individual decision by the Fellowship PD (Program Director), or Division Chairman. In others, it is a group decision by the entire faculty in the fellowship program. In others, the IM (Internal Medicine) PD, or Department of Medicine Chairman has a big role in selection. In others, IM people have no influence on selection, and might even be detrimental to your application if they have administrative wars.
It is most important to know this because based on that you will develop your strategy for getting that fellowship.
3. The IM program
Regardless of the influence of the IM program on fellowship selection, you must be in the big people's good books, i.e. the IM PD, the IM chairman; all the IM attendings must hold you in high regard. To achieve that you don't necessarily have to be the smartest person, you can always be the hardest working person, the polite person. Anyone who is hard working and polite will gain the respect of his seniors. Being cordial, a sense of humor, an amicable personality, and generally friendly further develops this relationship to definite support. This translates into a strong letter from the PD which is a compulsory requirement for fellowship application. Depending on the IM PD or IM chairman, it can get you a fellowship inside or outside your program.
More importantly, even if the IM PD cannot get you the fellowship, he can surely deny you it by giving a bad letter, and your chances of fellowship become zero.
A major investment in the IM program can also help you get Chief Resident (CMR) position which increases your chances of matching. This obviously requires a different set of skills which can be discussed separately.
4. The Fellowship Program itself (assume it is Cardiology)
As mentioned earlier, as an IMG in a community program your best chances are in the fellowship in house. You will need to make use of the available opportunities to develop strong relationships with the Fellowship PD, the Cardiology division chairman, and the Cardiology attendings.
I. The Speciality Elective e.g. Cardiology consult service or the CCU
Try to schedule it late in the first year of residency or early in the second year, so that you are confident in your clinical skills so can make a good impression, and not too far away from the beginning of the application season in December, so that you can get the LORs in good time. Invest heavily in this rotation, by reading up beforehand on all the guidelines, develop your EKG reading skills, see the patients very early so that you can read up on the latest up to date information so that you can leave a big impression on the attending during rounds. Try to get as many other rotations relevant to Cardiology (i.e. CCU, Research) in the first 9 months of the second year, i.e. before the rank order list deadline.
II. The Speciality clinic
Most programs give you a chance in the second year to do an additional clinic in the subspeciality of your choice. Try to work with the person who either makes the decision in selection for fellowship (PD or chairman), or at the minimum someone who is known to be supportive, someone who will back you all the way. This person will be the one who you will have the greatest contact as you will be working with him/her for the longest time, and will be the one who will give you the best LOR. So you need to choose him wisely. If he is the PD and he is a person who is impossible to impress then avoid him as working with him might do more harm than good, and just too stressful. On the other hand, if he has no significance in the fellowship selection then you will be wasting your opportunity.
The same principles of working hard to leave a big impression prevail in the clinic.
As an example, one of the residents in my program used to work in a subspecialty clinic, he worked hard to the extreme, staying in clinic up to 8 pm at times over several months. Regardless of what rotation he was doing, he would show up to clinic, and just work the patients, amazing work ethic, that was the reason he was selected in a fellowship that traditionally didn't take from within our IM program.
III. Research
This is a contentious issue. It is said that research counts heavily in selection in fellowships. But those who are selected into fellowships by merit of their research usually did it prior to residency!!
For research to make a difference in your application for a high stakes fellowship, it must be high quality, i.e. At least a prospective longitudinal study, or lab based research. Both of which are very hard to do during residency.
What you can do is small retrospective studies or case reports that can be a testament of your hard work and dedication. By working on research with the Cardiology attendings, you will be doing their scutwork, and hence will be valuable to them, and this will register when it comes to putting that rank order list. If you work with the fellows on research, make sure that you get attending “facetime” so that they can get to know you, don't be the fellows scutmonkey for free, your remuneration will be in the form of attending facetime!!!
4. Plan B
After you have done all the effort and the Match results come and you haven't matched, or you didn't get any interviews to start with, DON'T lose faith. Pick yourself up again, reassess the situation, and look at your options. Look at your CV, if you have a visa get a green card, if you have a green card, do some big time research, NIH if possible. Re apply, keep doing it and something will give.