First, you rearrange the terms so that ones with a common factor are together.
Ab + 4 + A + 4b = Ab + A + 4 + 4b (we have swapped the order of the middle two terms to get the order we want)
= A(b+1) + 4(1+b) (we have factored the first 2 terms, and the last 2 terms. We recognize that 1+b = b+1, so we can factor once more.)
= (A+4)(b+1)
Ab + 4 + A + 4b = Ab + A + 4 + 4b (we have swapped the order of the middle two terms to get the order we want)
= A(b+1) + 4(1+b) (we have factored the first 2 terms, and the last 2 terms. We recognize that 1+b = b+1, so we can factor once more.)
= (A+4)(b+1)