Integrable and chaotic polarization dynamics in nonlinear optical beams