Estimation and Optimization of Information Measures with Applications to Fairness and Differential Privacy