That's a really good question.
Sound is fundamentally (rapid) changes in air pressure. If you were to plot these changes on a graph, you'd end up with what looked like a wave - a pressure wave. Each separate sound has an individual waveform.
In ISOLATION therefore, there would be a nice wave corresponding to someone talking, and a separate wave corresponding to a car driving past, and yet another distinct wave corresponding to the leaves blowing outside.
But the brain has no such luxury. If these three things are happen at the same time, then the ear just receives a messy conglomeration of all of them at once. So how do we separate the sounds out again?
The answer is that it comes down to the brain's processing of the unruly wave that the ear gives it. It performs (unconsciously, of course) what is known as a Fourier analysis, whereby the various distinct waveforms are teased out and separated again.
This sounds really complicated, and it is, but it is still mathematically possible. In fact we know it is. A CD (or record, or tape) produces a single master waveform, one that is cleverly designed to mimic the combined waveforms of, say, a rockband. The brain dutifully teases out what it believes to be the constituent waveforms - the sound is unpacked into drums, bass, guitars and vocals. But of course these individual waveforms aren't actually there to start with.
It's really quite ingenious, don't you think?