Analytical framework for quantum alternating operator ansätze