Object pronouns like lo, la, me, and te don't always sit in the same spot in a Spanish sentence. With a conjugated verb they come first; with an infinitive, a gerund, or a command they can move to the end and attach directly onto the verb. The rule depends on what kind of verb form they're paired with.

The short version

Before the verb is the default with any conjugated verb. Attached to the end is what happens with an infinitive, a gerund, or an affirmative command.

Before the verb

With a conjugated verb

lo veola conozcoles escribono lo quiero
Lo veo todos los días.
I see him every day.
A conjugated verb — the pronoun goes right before it
Te llamo esta noche.
I'll call you tonight.
Same rule with a different conjugated verb
No lo entiendo.
I don't understand it.
"No" comes before the pronoun, not between the pronoun and the verb

Attached to the end

With an infinitive, gerund, or affirmative command

quiero verloestoy escribiéndoledímelollámame
Quiero verlo.
I want to see him.
Attaches to the infinitive (lo quiero ver also works)
Estoy escribiéndole una carta.
I'm writing her a letter.
Attaches to the gerund, with an accent added to keep the stress in place
¡Dímelo!
Tell it to me!
Affirmative commands always take the pronoun at the end

¡Cómpralo!, pero no lo compres si es caro.

Buy it!, but don't buy it if it's expensive.

Affirmative commands attach the pronoun to the end (cómpralo); negative commands flip back to the pronoun-before-verb rule (no lo compres) -- the one case where the placement rule reverses itself depending on polarity.

Ready to test yourself?

Take the quiz and see if the placement rule has become second nature.