All of the above.
The first factor for single-charged-site molecules is the valence of that charged site. Other things being equal, the higher the charge, the more tightly the molecule "sticks" to the opposite charge site. Partially ionized weak acids or weak bases can be considered as fractional charges for this purpose.
Given the same valence, charge density plays a role. The denser the charge (i.e., the smaller the site), the more tightly the molecule sticks.
Given the same valence and charge density, molecular size will affect retention (large molecules may not be able to nestle as close to active sites on the ion exchanger compared with smaller molecules).
For multiple-charged-site molecules, in general, the more charged sites available to interact with the ion exchanger, the stronger the retention. This is a function of the number of charged sites and the geometry of the molecule. Eg., two charged sites on the same side of a big molecule (such that both can "see" the ion exchanger) will give stronger retention compared to two charged sites on opposite sides (such that only one at a time can interact).
That's the general hierarchy, but as you can imagine, the number of possible combinations is immense (do two low-density charged sites on the same side of one molecule trump one high-density site on another?), which is why we have to do experiments!