An example of an antecedent is the word "Bill" in the sentence "When Bill gave me the money, I handed him a receipt. An antecedent is a noun or noun phrase to which a pronoun refers. Even though the prefix "ante-" in the word "antecedent" indicates a word coming before another word, antecedents can follow the pronouns to which they refer, as in the sentence, "When he gave me the money, I handed Bill a receipt."
In both of the above example sentences, the pronoun "he" refers to "Bill." "Bill" is the antecedent in both sentences even though it precedes the pronoun in one sentence and follows it in the other.
A pronoun must agree with its antecedent in number and in gender (when applicable). In the example sentences, the antecedent is a singular, masculine noun, so the pronoun must be also. In the sentence "When Bill and Barbara gave me the money, I handed them a receipt," "Bill" and "Barbara" are compound antecedents and are, therefore, plural. The pronoun "them" must also be plural.
Indefinite pronouns can be a little trickier, but the same rules apply. In the sentence "When anyone gives me money, I give him a receipt," "anyone" is the antecedent. It is a singular indefinite pronoun, so the pronoun referring to it must also be singular. In that particular example, "him or her" could be used since "anyone" can refer to either gender.