Hypergeometic test for the overlap of two set of genomic intervals (e.g. from Chip-seq data) Suppose I have done two Chip-seq experiments. Now after the bias correction step such as MACS2, I get two set of genomic intervals (or peaks, as what is usually called) that corresponds to each of the experiment. I want to test the significance of the overlap of these two set genomic intervals that corresponds to each experiment.

The common test employed seemed to me is the Hypergeometic test. There's even a package specifically aim for this task: ChiPpeakAnno. 

Recall from the Hypergeometric distrbition -- the analogy is that we have a bag of marbles with two different colors, say one blue and another red. A sample from such distribution consists of marbles drawn from this bag, and a probability measure for this distribution is the number of blue marbles in the sample. 

Could someone explain what is the correspondence between the hypergeometric test and the significance overlap between two different set of genomic intervals?
There is no such thing as a hypergeometric test, at least in statistical textbooks. It's a fisher test based on hypergeometric distribution.

If it is chip-seq for the same target, i.e biological replicates, significance of overlap is not quite meaningful. You get more information by for example checking the correlation of the coverage between your replicates using deeptools or anything else.

If you are comparing between two different targets, for example, chip for two different histone marks, you can use the fisher test or chi-square this way. 


Partition the genome in X bp bins, these are all your marbles
Identity those that overlap with peaks from target 1 and those that don't
Do 2. for target2 
construct a contingency table using 2 and 3.


So you should end up with something like this (purely made up): 

                      no_overlap_target2 overlap_target2
  no_overlap_target1               9799             112
  overlap_target1                    88               1


And if there is overlap, the bottom diagonal with be higher.. less on the off-diagonal, and you can test it with a fisher.test.