Every joint takes half the interior angle
A regular polygon with N sides has interior angles of (N - 2) x 180 / N degrees, and each piece is mitered at half that. Four sides cut at 45 degrees, six at 60, eight at 67.5. Enter the side count and the size across flats and the calculator returns the miter angle and the length of each side.
Accuracy matters more than the number
Angle errors multiply around the frame: a half degree off on eight pieces leaves a visible gap at the last joint. Cut a test frame in scrap, and tune the saw with a reliable reference rather than trusting the detents.
Sizing the pieces
The side length is measured along the face of the stock between miter points. Add a glue and trimming allowance before cutting; polygon frames forgive nothing. For crown molding, which adds a bevel tilt on top of the miter, use the compound miter calculator.