1) where you did residency or the strength of your LOR's (including what they say and who they are from)
I couldn't tell which of these was more important...probably the 1st one but the 2nd thing is also important. "Who you know" becomes very important at the time of making rank lists, as people may be able to pull strings for you and most programs prefer taking people who have the recommendation of someone they know.
After that, they care about your research (past production) and area of focus that you say you want for your career - this can become a deciding factor particularly if you make it to the interview stage. Some places also care about test scores (USMLE) and/or even sometimes med school grades (these two things vary a lot program to program, though). "Soft" stuff like how cool they think you are and how well they think you'll fit into the program also count for a surprising amount, I found. This may include regional biases or personality or hobby preferences (such as if they like athletic fellows, people they perceive as urban and sophisticated, those from the South or West, etc.). A few programs also don't like to take many women because they fear having to give someone maternity leave and a smaller number may be trying to recruit a female trainee or an underrepresented minority (1 per class or so).