It's commonly said that one is talking to (in) his- or himself. Does that mean there are two of the person in question: the one who's talking and the one who's listening?
There are definitions in question here. When you say that the person talking is
talking to (in) his- or himself.
I will assume the current psychological definition of a self. There are many other definitions, if you meant one of those please let us know. An additional assumption I am considering a healthy individual, so we will not be talking about whether multiple personalities constitute different "self" or not. Further, there is an assumption that the self is a single entity in your question so I will not be talking about conversations between say the ego and the id. Given those constraints, I agree with @Alex there is only one person present.
As for the follow on question, why do it then? I expect that we do this because the act of speaking changes how we think about a topic. It requires more precision and effort. Helps us to clarify our thoughts.
From two different approaches, you get something like the same answer.
From traditional psychoanalysis, the personality is always fragmented, we are never completely free of repression or its associated fear, and therefore always have some degree of dissociation. So our point of view is made up of competing beliefs and desires, and one complex with in it is addressing another. "The part of me that owes my father A and B needs to believe X." "The part of me that owes my husband C and D needs to believe Y." "Since X and Y are incompatible, which shall I repress more deeply? Which of these obligations is more central to my identity?"
From a more modern model of thought offered as an abstract by Daniel Dennett, the mind is a parallel process that continually rewrites the stories that explain its behavior. The stories circulate in 'multiple drafts', and talking to yourself is using the serial linguistic mechanism to consciously edit together two drafts that exhibit a potential discrepancy. "I don't know X." "But you do know X, because you have decided Y (a fact from another 'draft') and that implies X." "Ok, so what if I do know X? Then is that consistent with Z, or does Z need reconsidering?" ...