when we rub objects together, what determines which material will pick up electrons?

There is no single factor that uniquely determines whether a certain material is going to gain or lose electrons, but one of the most important properties is the electron's affinity of a certain material. If the affinity of a material is negative, that material will most probably be a receiver of electrons. If the affinity of a material is positive, that material will most probably be a donor of electrons. You can find here a detailed timetable showing the relation between the tendency of receiving / donating electrons and the electrons affinities for a list of materials.

That is not a super-strict role, it is more of a strong correlation. The charge transfer between two bodies depend also on adhesion mechanisms and the electrochemical potential, you can find some details here