General mechanism for negative capacitance phenomena