Why is the contour integral in upper plane different from the lower plane in this case?
$\int_{-\infty}^{\infty} dk\frac{1}{(k-a)(k+a)(p-k-b)(p-k+b)}$
where $\text{Im }a$ and $\text{Im }b$ are negative and $p$ is real. Besides, $\text{Re }a$, $\text{Re }b$, and $p$ are positive.

The integrand vanishes sufficiently fast at large $|k|$ that you can close the contour in either the upper or the lower half-plane. You will get the same answer in either case. In other words, the sum of the residues at the four poles will be zero. Why don't you check that this is indeed true?
Note added: For a general case $$ \frac{1}{(x-a)(x-b)(x-c)(x-d)} $$ the residue sum is $$ \frac 1{(a - b) (a - c) (a - d)} + \frac{1}{(b - a) (b - c) (b - d)} + \frac{1}{(c - a) (c - b) (c - d)} + \frac 1{(d - a) (d - b) (d - c)} $$ A somewhat tedious calculation shows that this sum is zero. A quicker way to see that this must be true is to consider the partial fraction decomposition $$ \frac{1}{(x-a)(x-b)(x-c)(x-d)}=\frac{A}{x-a}+ \frac{B}{x-b}+\frac{C}{x-c}+\frac{D}{x-d} $$ and take the large $x$ limit. Then the LHS is $1/x^4+ O(x^{-5})$ while $$ RHS= \frac{A+B+C+D} x+ O(x^{-2}) $$ Agreement requires $A+B+C+D=0$ togther with similar, but non-trivial-looking, quadratic and cubic relations on the $A,B,C,D$.