Renal compensation
Renal compensation is a mechanism by which the kidneys can regulate the plasma pH. It is slower than respiratory compensation, but has a greater ability to restore normal values. Kidneys maintain the acid-base balance through two mechanisms,- the secretion of H+ ions and the reabsorption of bicarbonate HCO3 from urine which is then released into the blood. The regulation of H+ ions and bicarbonate HCO3 is determined by the concentration of the two released within the urine. These mechanisms of secretion and reabsorption balance the pH of the bloodstream. A restored acid-base balanced bloodstream thus leads to a restored acid-base balance throughout the entire body. Human pH 
An ideal pH within the human body ranges from 7.35-7.45. When the pH of the body falls below 7.35, an acidemia occurs. Similarly, when the pH of the body rises above 7.45, an alkalemia occurs. Renal compensation is one of the many compensatory mechanisms within the body which assist the pH level in ranging between 7.35 and 7.45 as the body cannot function properly when the pH falls out of this range. Respiratory and renal changes in acid-base elimination typically contrast each other, and respiratory pH disturbances often commence renal compensation. The renal compensation process usually takes a few days to complete as it is dependent upon changes in the reabsorption of bicarbonate. End-staged renal diseases as well as chronic kidney diseases increase the overall risk of individuals developing pneumonia due to the interactions between the kidneys and the lungs. Both organs are targets of similar systematic diseases and loss of normal function of one organ can induce the disregulation of and abnormalities within the other. Production in the Kidneys 
In respiratory acidosis, the kidney produces and excretes ammonium (NH4+) and monophosphate, generating bicarbonate in the process while clearing acid. There is also an excretion of Cl- and a reabsorption of sodium, resulting in a negative urinary anion gap. In respiratory alkalosis, less bicarbonate (HCO3−) is reabsorbed, thus lowering the pH. References

Acid–base disturbances