Psychologists have found that talking to oneself can provide better reflective capacities and behavior management.
Ethan Kross, at the University of Michigan, has studied both spoken and silent self-talk that can be used for motivating or instructing oneself through a task or difficult moment. Apparently, this talk is more effective in the second or third person. As Dr. Kross puts it, "psychological distance helps" to approach a problem as though one were "advising" someone else. This is easier for the brain to handle because it automatically implies a certain degree of impartial perspective in the situation.
Another researcher, Gary Lupyan at the University of Wisconsin-Madison, has found support for the "feedback hypothesis": if someone names an object out loud to themselves while they are looking for it, it will help them visualize it, and therefore find it. (This assumes that they know what it looks like to begin with; otherwise, the verbal feedback can be counterproductive.)
A third study, published in Procedia - Social and Behavioral Sciences, examined the results of basketball players using self-talk and found that "motivational self-talk worked best on tasks based on speed, strength and power, while instructional self-talk worked best with tasks that involved focus, strategy and technique." So, the manner, context, and type of self-talk all appear to influence behavior in different ways.