Playing by ear is the ability to play a piece of music (or, eventually, learn an instrument) by simply listening to it repeatedly. The majority of self-taught musicians began their education this way; they picked up their instrument and began playing an easy melody from a well-known song, slowly picking out the notes as they went along. And even after these musicians master their instruments or a particular song, playing by ear still plays a large role. Many pop and rock bands don't play or write their songs based on sheet music, they figure the songs out by playing by ear. It's even common among non-musicians. Ever sit down a piano and mindlessly pick out the tune to "Mary Had a Little Lamb"? What about grabbing a guitar and suddenly finding yourself playing the opening licks to "Smoke on the Water"? That's playing by ear. You're able to play part of the song just because you've heard it so often.
Playing by ear is a valuable technique for many musicians; learning songs based solely on hearing them is a great way to understand song and chord structure. In fact, a great number of rock and pop musicians learned to play their instruments this way. Instead of picking up a book or taking lessons, they concentrated on figuring out the notes and rhythms to a song until it was mastered. Then they moved on to another song. And another. Gradually, they learned their instrument just by playing by ear -- and in the process learned how to effectively structure a song in that particular genre. Playing by ear is also beneficial in helping a musician develop his or her own style; sure, they'll at first mimic the style of the song they're imitating, but the amalgamation of the music that they're playing by ear will help them create something distinctive, something indicative of them only.
Though classical musicians are generally educated based on tons of music theory and sight reading, some methods rely on playing by ear. The Suzuki method of musical training, for instance, claims that learning music is the same as learning a language; it's acquired by years of hearing it, eventually coupled with formal training. Just like we pick up our language by listening to our parents and subsequently attending school, we can learn music by playing by ear and later taking formal lessons. The Suzuki method of playing by ear has proven to be fairly effective, but it is sometimes considered harmful as the children progress in their education; playing by ear at such an early age (and long before formal training) has the potential to damage the child's ability to actually read music instead of just picking out the notes or melodies.