This is an excellent question and one that researchers have yet failed to conclusively answer. There is a good evidence that psychotherapy does work but exactly how is not yet known. There is a large (and growing) body of scientific research which suggests that most of the benefits of psychotherapy are in the quality of the relationship between client and therapist and from experience and this is the research I feel most closely aligned with.
For me it makes sense that talking with someone can influence what you do and change the way you feel about things. This is obvious from the simplest of everyday examples - if someone tells you a joke and you find it funny, you laugh or if someone next to you finally tells you the smell of the lunch you've been eating at your desk every day offends them, firstly, now you know and secondly, now you can choose to do something about it. Thirdly, maybe you might get on with them better because maybe they just assumed you knew and did it anyway and when they see your surprise, they might realise you didn’t even know you were causing them a problem.
Similarly (and bearing in mind the safe, confidential nature of the psychotherapy relationship mentioned above), if I was to notice that whenever you didn't agree with something I suggested or were uncomfortable with a question I asked you in a therapy session, you 'went quiet', I might let you know that when you do this, your feelings about what I've said to or asked you aren’t clear to me. Chances are, you do this kind of thing a lot and by us bringing it to your awareness in therapy sessions, you can start making choices about whether to speak up or not in situations you aren't happy with.
Generally, as therapy progresses, clients tend to uncover more and more things they do which they were previously unaware of. Again, though this may sound like common sense, the tricky part (and the part that many people find hard to believe) is that our conscious actions are based on many unconscious assumptions which (because of their unconscious nature), we are unaware of on a day to day basis. It’s the increase in this awareness, in psychotherapy, that forms a big part of resolving personal problems.
Finally, I think whether we realise it or not, we completely exist in relationship with other people and the things they say (and do) influence us all the time. Think of psychotherapy as 'talking in a special way' with the main objective to be understand yourself better and use that understanding to change yourself.