"Te" is an object pronoun that can be acted on or receive the action on an object.
Yo te habla: I speak to you. Yo te doy un regalo: I give you a gift.
"Ti" is used in prepositional phrases, along with the pronoun mí (to replace yo). Fortunately for all of us, the rest of them are the very same as subject pronouns... de mí, ti, usted, él, ella; de nosotros/as, vosotros/as, ustedes, ellos, ellas. Of course, don't forget conmigo and contigo.
Tú is a subject pronoun. Ti is a stand-alone object pronoun that can be part of a prepositional phrase. The difference is the same as the one between English "he" and "him". "He" is a subject, "him" is an object.
The slightly weirder thing is te. Te is an object clitic. It gets called a pronoun, but a fair number of linguists don't think it's a pronoun, or even really a word. All of the clitic pronouns (me, te, lo, la, le, se, nos, os, los, las, les) are actually special forms of verb inflection.
It is not uncommon to see both the actual pronoun, and the clitic, deployed in the same sentence, for emphasis. For instance: A ti no te gusta correr. Pero a mí, me gusta. You don't like to run. But me, I like it.