How does a buffer work?

It bonds with the added H+ or OH- in solution.