Briefly, and without too much attention to minute details of acid-base balance or disorders, and focusing on humans in particular, the lungs expel carbon dioxide which is an acid while the kidneys reabsorb bicarbonate, which is a base. When blood pH lowers, producing acidemia, then the kidneys will respond by reabsorbing more bicarbonate, releasing it back into the blood to raise the pH back to a normal range. The kidneys will also function to secrete acids (such as carbonic acid) from the urine to help raise the pH of blood and tissues. When a person develops an abnormally high pH (alkalemia), the kidneys can secrete more bicarbonate from the body and the lungs can retain CO2 through alterations in breathing. While there are other issues at play, the chemical equation to remember is:
CO2 + H2O <-> H2CO3 <-> HCO3 + H
Depending on the level of detail needed and the course for which this question is posted/education level, then more specific information could always be provided but this is a brief overview. For a complete lecture on acid-base balance I am always happy to help one-on-one!