It's best not to ask why parrots talk — which is a mystery involving parrot emotional needs, and not really our business. The real question is, how do they manage it? How exactly are parrots able to mimic the way a human sounds, while other birds cannot? And why can't humans make bird sounds?
I've never entirely understood why people own birds as pets. They don't cuddle. Trapped in their cages, they embody a sad metaphor for the imprisonment of the spirit. If you let them out of their cages, they have the power to fly above you and crap on your head. There doesn't seem to be an upside. If I were to have a bird, though, I suppose it would be a parrot — since they at least have the ability to imitate mindless chatter, and therefore keep me company at least as much as a television does.
Humans have a larynx that sits at the joining of the esophagus and the windpipe, which allows us to make a wide range of sounds and also choke to death on food.
Birds, meanwhile, have a syrinx — a hollow space with flexible walls like the membrane of a drum, which sits right at the joining of their lungs to the wind pipe. Overall, they make fewer sounds — but the placement of their syrinx allows them to do something that people can't. Because it makes sounds by vibrating various walls at various levels of tension, and because it straddles both lungs, a bird's syrinx can produce two sounds at once. This means that birds, using one chamber or another, can sing duets with themselves, can sing a rising note in one section and a falling one in another, can sing thirty different notes a second, and can breathe through one chamber while continuously singing through another. But most birds can't mimic sounds like human speech.
How do parrots manage what other birds fail to do? Two reasons: their evil parrot brains, and their creepy thick parrot hybrid tongues. Most birds are influenced by the calls of their fellows, but the majority of their songs are hardwired into them. They'll sing these songs, even if they've never met another member of their own species.
Parrots learn by listening. Their brains are larger, and their instinct to listen and repeat more developed than those of other birds. But other birds, even if they had the brain for it, have short, thin tongues that can't even approximate human speech. Parrots have thick tongues that let them say sounds like "l" and "g," even if their syrinx makes the words sound vaguely robotic.
The parrot most famed for pushing the limit between mimicry and actual speech was Alex, the African grey parrot, who seemed able to both answer his keepers questions and put existing words together to name new objects. He could thank his brain and his tongue for that. No word, though, on whether he ever flew up high and pooped on his trainers' heads.