The only way you can know for sure is to analyze the reaction using oxidation numbers, and figuring out which elements lose/gain electrons. Here is a link explaining how to assign oxidation numbers in a reaction.
As an example, consider the reaction, what is the oxidation number of sulfur in this particular molecule, $S_2O_3$. According to these rules, which are in order of priority, the oxidation number of oxygen is $-2$, unless it is bonded with hydrogen or fluorine, which in this case, it is not. Given that we have three oxygen atoms in this molecule, the total oxidation of oxygen is $-6$, which must be offset by two sulfur atoms so the total oxidation number is $0$. Obviously, the oxidation number of a single sulfur must then be $+3$, so that the molecule is neutral.
In any reaction, you would essentially have to do this for every molecule on both the products and reactants side in order to determine which atoms are losing/gaining electrons.