Leísmo should not be confused with Yeísmo.
Leísmo ("using le") is a dialectal variation in the Spanish language that occurs largely in Spain. It involves using the indirect object pronouns le and les in place of the (generally standard) direct object pronouns lo, la, los, and las, especially when the direct object refers to a male person or people.
Leísmo with animate objects is both common and prescriptively accepted in many dialects spoken in Spain, but uncommon in most others. It thus typically correlates with the use of the preposition a for animate direct objects (for this "personal a", see Spanish prepositions). Leísmo is always rejected in linguistic prescription when the direct object to which it refers is not an animate object. For example:
Spanish; Castilian: Veo al chico ("I see the boy") → Lo veo (standard Spanish, with lo)
Spanish; Castilian: Veo al chico ("I see the boy") → Le veo (leísmo, common in Spain; other regions prefer lo veo)
Spanish; Castilian: Veo el árbol ("I see the tree") → Le veo (not accepted in linguistic prescription — the tree is not a person)
Le and les are properly speaking the epicene indirect object pronouns, used for both masculine and feminine antecedents, whether animate or inanimate. In certain dialects the reverse occurs and the indirect object pronouns are replaced by lo, la, los, or las (loísmo and laísmo), but this usage is not accepted by the Real Academia Española (Royal Spanish Academy):
Le voy a dar un regalo (a él/ella) ("I am going to give him/her a present", standard) → Lo voy a dar un regalo
Dile que la quiero ("Tell her I love her", standard) → Dila que la quiero
There are various diachronic and synchronic reasons for the use of le/les for direct objects. To understand why there is vacillation and hesitation in usage, it is helpful to understand these often-conflicting linguistic forces.
Thus, éste, ésta, esto; ése, ésa, eso; aquél, aquélla, aquello; el, la, lo; él, ella, ello.
Hence some speakers say le vi ("I saw him") for any masculine person, la vi ("I saw her/it") for any feminine noun, and lo vi ("I saw it") to refer to an inanimate masculine noun (e.g. Vi al piso → Lo vi), or a clause (Viste lo que pasó anoche → Lo viste). This gives us a set like the above: le, la, lo.
Furthermore, le also follows the pattern of me ("me") and te ("you") which operate as both direct and indirect objects.
All of the theoretical reasons for using le/les detailed above actually influence the way Spanish speakers use these pronouns, and this has been demonstrated by various surveys and investigations. Not all usage of direct-object le/les is dialectal, however. In some cases, it is universal across the educated Spanish-speaking world.
Let us first look at dialectal extremes. There is leísmo (covered under point a above) motivated by the tendency towards masculine e in uneducated Madrid speech. This actually used to be quite standard, and the Real Academia only stopped endorsing it in the 1850s. We therefore find in old texts:
Such speakers would say le afirman in reference to a word like el hecho, la afirman in reference to a word like la verdad, and lo afirman only in reference to a general neuter "it".
The second extreme leísmo is the one motivated by the second point mentioned: the tendency to use indirect objects for people. This is noticeable in Northwestern Spain, especially Navarre and the Basque Country, where regional speech uses le vi for "I saw him/her" and lo/la vi for "I saw it". The same phenomenon is sporadically heard elsewhere, e.g. in Valencia and Paraguay.
Now let us look at less extremely dialectal cases. For the majority of educated speakers in Spain and parts of Latin America, neither of the two tendencies (a or b) is enough on its own to justify the use of le/les; but together they are. Thus, speakers who would reject sentences like le vi for "I saw it" and le vi for "I saw her" would nevertheless accept and use le vi for "I saw him". Indeed, this use of le to mean "him" is so common in an area of central Spain that some would call the use of lo vi to mean "I saw him" an example of loísmo/laísmo, i.e. the dialectalism whereby lo is overused. The Real Academia's current line is that le for "him" is officially "tolerated".
A case on which the Academy is silent is the tendency described in point b1. It is perfectly common in educated speech in many parts of the world to distinguish between no quería molestarlo "I did not mean to bother him" and no quería molestarle "I did not mean to bother you". Those Spaniards who would not just say le anyway for the reasons explained in the last paragraph are likely to use le in this case. Butt & Benjamin (1994) says that their Argentine informants made this distinction, whereas their loísta Colombian informants preferred molestarlo always.
The Academy is also silent on the tendency described in b2; however, it is universal across the Spanish-speaking world. In a questionnaire given to 28 Spaniards in the Madrid region, 90% preferred la halagó for "he flattered her" and 87% preferred le halagó for "it flattered her". García (1975) reports a similar but less extreme tendency in Buenos Aires: only 14% of García's sample said él le convenció for "he convinced him" (the rest said él lo convenció). With an inanimate subject, a slight majority (54%) said este color no le convence.
García reports Buenos Aires natives differentiating between lo llevaron al hospital and le llevaron al hospital depending on how active the patient is, although anecdotal evidence suggests that Argentines are more loísta than this, and would prefer lo in both cases.
Point b3 is also backed up by the fact that many Latin Americans distinguish between le quiero "I love him" and lo quiero "I want him" (or indeed "I want it").