Nope, kids don't learn to talk, at least in the traditional sense of "learn". Nobody teaches them. They don't study or use books or note cards to memorize words and diagrams to figure out sentences. They don't learn to talk--they acquire language.
The famous Chomsky postulated that there must be inborn structures for acquiring language. He noted that it would be impossible for children to know, by age 5 or so, their native language if they were starting from a blank slate.
He also pointed to the kinds of errors children make, and said that since children haven't heard the majority of these errors, how could they make them? For example, my oldest, when I told her to "behave", responded with "I AM haveing mom!" She apparently hypothesized from be + constructions like Be good, Be careful, Be quiet, etc and decided "behave" functioned similarly.
I laughed and did not correct her, as is common in parents. These errors are funny and charming and much of the time we let them go. Indeed, we don't correct most of the errors our children make, at least not in syntax. We DO correct them on meaning.
Are I going to the store?
No, you're going to school.
Chomsky's take was that children generate language....they receive input and some language-specific parts of the brain fit the input into existing structures, perhaps universals of all human languages (all languages have something verb-y and noun-y, all languages can make questions, all languages use a subset of all the available human vocal tract sounds, and more). Theoretically, children are born with some innate understanding/knowledge/structures of language and through exposure, hone in on the language or languages they are exposed to.
Children seem to employ similar strategies in language acquisition. The overgeneralize: my grandson has a chihuahua named Rosie and so he calls every dog Rosie, never mind that my dog Ranger is a really big Husky Shepherd mix. But you know, when you don't have a large vocabulary it makes sense to use a word widely, like Rosie for dog, and pay more attention to other words that you might need more.
They overgeneralize in syntax, too, as in the "behave" example above. And in pronunciation, they acquire so-called simpler sounds first, and sounds that are maximally distinct. Children AND second language learners take longer to acquire these sounds: th, r, l, y, sometimes w, f, sh. Children acquire sounds in a similar pattern: early sounds are often b, m, and a central vowel. (is that why so many languages have words for Mother that begin with m?)
Similarly, children seem to operate on the principle that there is one word for each thing, and the word describes the whole of the thing. So Rosie means dog--not dog ears or nose or tail or legs but the entire dog. Also a smart strategy, since there may be many times to use dog but fewer times to refer to a dog's ears.
Language cannot be acquired by simply hearing a language, via TV, for example. It requires interaction. And interestingly, children show interactional capabilities well before they can speak.
Even as infants, they can communicate through crying, giggling, smiling, and eye contact. A nursing infant will even take conversational turns with a caretaker. When the caretaker speaks, the infant might pause and listen. When it is the infant's turn, she or he may suck. Early turn taking!
They can also express rather complex meanings before their syntax is acquired. Maggie, my oldest, came into the kitchen when she was just 4 and said "Gee, mom, we haven't had candy in a while". And of course she was not making a simple declarative observation; she was making an indirect request--go buy us some candy. An amazing skill.
Children have no difficulty in acquiring more than one language, given sufficient input. Sometimes parents think there is only room for one language....or non-native speakers think they have to emphasize just English. But that's a mistake. Children can acquire more than one language, the brain can handle it, and there is little difference in the acquisition rates of bilingual vs monolingual children. Bilingually raised children may seem slightly later than monolinguals; ie, rather than largely complete by age 5, a bilingual's language may be largely complete by age 6. But with two languages!
While the basic grammatical structure, and most of the phonology, are acquired by age 5 or 6, of course we continue to develop our language. Additional structures and much more vocabulary are acquired through age 12 or so. When we go to school, we are formally taught reading and writing skills, more formal language, and more varied and content-specific vocabulary. We never really stop developing our language....but the early years are critical and the most productive.
We can't all raise our children bilingually, thus the need for language immersion programs at the earliest years of schooling. Children can become bilingual even starting with a new language at 4 or 5, with sufficient and sustained input. Let's make that a goal for our elementary schools.