Symmetries in Semidefinite and Polynomial Optimization: Relaxations, Combinatorics, and the Degree Principle