Consider the sum $$f(z)=\sum (pz^l)^{n_1}(qz^{-1})^{n_2}=\frac1{(1-pz^l)(1-qz^{-1})}.$$ Our sum is $\frac1k\sum_{z:z^k=1} f(z)$.