Capacitance spectroscopy of localized states at metal‐semiconductor interfaces. I. Theory