Do you get to pick your residency that you want to do?
Within reason. There are no quotas so, in effect, all fields are open to all applicants.
Or is it based on your marks or an exam or something?
Here is where reason comes in. Yes, obtaining the residency of your choice is about your scores on the US medical licensing exams, your grades (marks), letters of recommendation, evaluations during clinical rotations and an ephemeral amount of interview prowess.
Do most people get to do their residency of choice?
Most do. However, by the time it comes to applications for residency, the groups tend to self-select. That is, a student with sub-par scores is likely to realize that the chances of matching into something super competitive, say Derm or Ortho, and will not apply. So most do tend to get the residency of their choice, but it may not be their (real) first choice.
For example I have a passion for radiology and I would kill to get in... What is the likely hood of that person to get in? If she/he had average/below average marks in med school would it still be possible to get into that residency?
Perhaps, but it would be unlikely for a competitive specialty like rads. There are always exceptions to the "rule" - ie, the Derm resident who has average grades, or the Plastics resident with lower USMLE scores. But most students realize that they are more likely not to be the exception to the rule.
Hope that helps.