A unified approach to mixed-integer optimization: Nonlinear formulations and scalable algorithms