How do exon tandem exon duplications occur in the genome?
There is a section in the Human Molecular Genetics textbook about how such repeats do occur. Like the commentor said, it is likely a result of recombination. If there are repeats flanking a gene or an exon there can be paring between sister chromatids / chromosomes, which can result in the duplication. See Figure 9.7 here http://www.ncbi.nlm.nih.gov/books/NBK7566/#A1095

As for how does it "know": It doesnt. Its not just the exon that is duplicated though. It is also the DNA before and after the exon, which contains cis-elements that splicing factors bind to, which results in the exon being spliced into the transcript.

Splicing is pretty complicated but if just 50 bp upstream and downstream of the exon was also duplicated, it would probably be enough to cause some splicing of the exon. U1 and U2 snRNP bind immediately at the exon-intron junction, and the polypyrimadine tract is about 30 bp or so upstream from the exon. U1 and U2 and the polypyrimadine tract are all vital to splicing. I dont know of any work that shows the minimum requirement for splicing but if you have those 3 you will probably splice the exon at least part of the time. So in sum, its probably not just the exon that is duplicated. It is probably the exon plus the cis elements involved in splicing.