THE INDIRECT OBJECT ANSWERS "TO WHOM" OR "FOR WHOM".
HE GIVES MARIA THE BOOK.
TO WHOM DOES HE GIVE THE BOOK?
THE INDIRECT OBJECT TELLS US WHERE THE DIRECT OBJECT IS GOING.
EXAMPLE IN SPANISH:
JUAN ME COMPRA UN REGALO.
JOHN BUYS ME A GIFT.
IF BOTH DIRECT AND INDIRECT APPEAR, INDIRECT COMES FIRST. IF "L" BEGINS BOTH THE INDIRECT AND DIRECT PRONOUNS, THE INDIRECT IS CHANGED TO "SE".
OBJECT PRONOUNS USUALLY OCCUR BEFORE THE CONJUGATED VERB, EXCEPT IN THE CASE OF AFFIRMATIVES, WHERE IT IS PLACED AT THE END OF THE VERB.
GERUNDS AND INFINITIVES FOLLOW THE SAME RULE AS AFFIRMATIVES, EXCEPT THEY ARE OPTIONAL. THEY CAN BE ADDED ON THE END, OR PLACED BEFORE
Spanish Object Pronoun Position
Object pronouns (direct, indirect, and reflexive) usually precede the verbs they modify. However, in the case of infinitives, present participles, and affirmative commands, they often get attached to the end of the verb instead.
Object Pronouns with Infinitive
When one or more pronouns are used with a verb in the infinitive (including the perfect infinitive), the pronoun(s) are usually attached to the end of the infinitive.
Salió sin verlo - He left without seeing it.
Limpié la casa para venderla - I cleaned the house to sell it.
If the infinitive is immediately preceded by a conjugated verb, the pronoun(s) can either precede the conjugated verb or be attached to the infinitive.
Lo quiero vender / Quiero venderlo - I want to sell it.
Me voy a lavar / Voy a lavarme - I'm going to wash up.
When double pronouns are attached to an infinitive, an acute accent must be added to the last syllable of the infinitive, in order to maintain the correct stress on the word.
Quiere vendérnoslo - He wants to sell it to us.
Voy a dártelo - I'm going to give it to you.
Object Pronouns with Present Participle
When pronouns are used with a present participle or progressive tense, the pronoun(s) can either precede the helping verb or be attached to the participle.
Lo estoy mirando / Estoy mirándolo - I am watching it.
Las estábamos mirando / Estábamos mirándolas - We were looking for them.
Note that when the pronoun is attached to the participle, an accent must be added to the original stressed syllable in order to maintain the correct stress on the word.
Object Pronouns with Imperative
When object pronouns are used with negative commands, they precede the verbs. However, for affirmative commands they must be attached to the end of the verb.
¡No me ayudes! - ¡Ayúdame!
Don't help me! - Help me!
No se vaya (Ud.) - Váyase.
Don't go away. - Go away.
No lo comas - Cómelo.
Don't eat it - Eat it.
No me la traiga - Tráigamela.
Don't bring it to me - Bring it to me.
Again, when object pronouns are attached, an accent must be added to the verb to maintain the proper word stress.