All birds can talk. What you are asking about isn't talking, it is mimicry, the fact that the sounds the parrots make sound like human words.
Parrots are very intelligent birds, but are not the only ones who learn how to mimic. Birds learn how to mimic other birds to confuse them, as a starling would when it is going to lay its eggs in the nest of another bird, it calls to the other birds to find out where they are.
It was a matter of evolution, where their tongue is attached and such, but do not think of it as talking, it is simple mimicry



