It is important to realize that open source projects are rarely written from scratch, and there really isn't as much duplicated effort as it might seem. Because people are free to use other open source software in their projects, they are able to concentrate on just the parts that they are interested in, and reuse the other parts from other projects.
For example, there may be numerous web browsers, but many of them use the same layout engine. There may be many music players, but those developers aren't writing their own MP3 codecs. Someone has an idea for an improvement over what already exists, and they start a project to implement that idea, using the best of existing open source projects to fill in the gaps. Open source software makes this possible. It is actually proprietary software companies that often spend much of their time reimplementing the same common functionality that is found in their competitor's products, since their competitor's product is not open source and the code cannot be reused.