A pitcher is charged with a wild pitch when his pitch is so errant that the catcher is unable to control it and, as a result, baserunner(s) advance. (This is an important stipulation. No matter how poor the pitch, a pitcher is only charged with a WP if at least one runner moves up a base, and he cannot be charged with a wild pitch if no one is on base -- unless it allows the batter to reach base on a third strike.)
Wild pitches have commonality with passed balls -- which represent the same thing, but are the fault of the catcher instead of the pitcher. The decision whether a pitch is ruled a passed ball or a wild pitch is in the hands of the official scorer. But a general rule of thumb is that if the pitch hits the dirt or misses a catcher's glove altogether, it's a wild pitch.
Certain pitchers who struggle with their control tend to have high wild pitch totals. As a result, pitchers who allow a high number of walks often allow a higher-than-average number of wild pitches. Pitchers who possess very good curveballs -- or any other breaking ball -- also are at risk of throwing wild pitches. Sometimes the pitch is intended to bounce in the dirt, with the goal being to deceive the hitter into thinking it's crossing the strike zone at his knees before plummeting into the ground. This puts a burden on the catcher to block the baseball and prevent a wild pitch.
Watch: Hisashi Iwakuma throws a wild pitch.