There has been a misconception brewing about letters of recommendation. These letters are never guaranteed, they are earned. Once you have proven your worthiness to your attending physician during your clerkship and asked for a recommendation letter from him or her, they will decide whether or not to give you one.
So how do you increase your chances of getting one? The answer is: good timing. Mention to your preceptor that you will be applying for residency programs in the United States and you would like to know what is to be expected of you in order to receive a letter of recommendation for residency. Ask early because it may help the preceptor and their office staff pay more attention to you throughout the clerkship. But remember, do not ask frequently as it could be misconstrued as being too eager.