How to calculate statistical significance of sequence motifs
As far as I remember the exact probability computation is an open problem. The reason is that potential motifs can overlap, which makes probability computations for an arbitrary string non-trivial, and depends on the motif.

For example if he have a binary string of four digits, the probability of "01" will be 11/16, while the probability of "11" will be 8/16=1/2.

The simplest approximation is to assume that probability of the motif on every position of the sequence is equal and independent. In such case (this comes from this course):



(Probability of text of length N having at least t occurrences of a k-mer Pattern, A is the number of letters in the alphabet, n = N – t * k)

This approximation is very rough, there are better here.