Pitcher confidence usually determines how well a pitcher performs. It does help with accuracy, but it also helps with pitch effectiveness and how difficult it is to get strikeouts or induce other types of outs. The higher your confidence, the more strikes and strikeouts you can get, and the less hits and walks you allow. It affects the pitcher more than the hitter, but it does affect how easy/hard it is for the batter to hit against you. Thus, it affects how well you perform against a pitcher when you're batting—it's why that if you swing at literally everything he throws at you, it's going to be very difficult to get a hit.
Pitcher confidence increases in varied degrees by doing the following— Getting strikes, causing swings and misses, getting strikeouts, and getting outs in general. Also, when a batter fouls off a pitch, it counts as a strike, so it also raises confidence. Confidence increases more if the batter swings at a pitch that's out of the zone for a strike, for example (basically, the more you stupid you make the batter look, the more your confidence goes up).
Pitch confidence decreases due to the following—The batter takes a pitch for a ball, if you allow a hit of any kind (and the greater the hit, the more confidence you lose—allowing a HR causes more confidence to be lost than allowing a single), if errors of any kind are allowed, allowing a runner to score, hitting a batter, walking a batter, throwing wild pitches, or throwing passed balls. Stolen bases might affect confidence, but I haven't payed enough attention to be sure. Basically, if things hit the fan, pitcher confidence goes down the drain.
Another important note—confidence not only affects overall performance, but it also affects performance with each pitch in your pitcher's repertoire. For example, if you get a strikeout with a nasty curveball, your pitcher is going to be more confident in using that pitch. That, in turn, increases the pitch's speed, accuracy, and break. If you throw the curveball and the batter hits it for a HR, then you are going to lose confidence with that pitch and will have trouble throwing it accurately and for strikes.