all trials are independent. The chance of the kth failure happening on the nth trial is:

P(k-1 failures in n-1 trials) x P(nth trial is a failure)

The first term is just the "regular" binomial pmf (with suitable parameters) and the second term is (1-p).