Example 3.3.6 A polygon with $n$ sides $(n>4)$ (convex or concave) can have at most how many right angles?
Solution: Suppose there exists an $n$-sided polygon with $k$ right angles. Since all other angles are less than $360^{\circ}$, we have $(n-k) \times 360^{\circ} + k \times 90^{\circ} > (n-2) \times 180^{\circ}$,
$$
k < \frac{2 n + 4}{3}.
$$

Since $k$ and $n$ are integers, $k \leqslant \left[\frac{2 n}{3}\right] + 1$.
If $n \geqslant 6$, we can construct an $n$-sided polygon with $\left[\frac{2 n}{3}\right] + 1$ right angles.
For $n = 6, 7, 8$, examples are shown in Figure 3-14.
For $n \geqslant 9$, we construct inductively:
For all interior angles greater than $180^{\circ}$, we can cut out a "triangle with one less vertex" as shown in Figure 3-15, which adds three vertices and two right angles. Therefore, from an $n$-sided polygon with $\left[\frac{2 n}{3}\right] + 1$ right angles, we can construct an $(n+3)$-sided polygon with $\left[\frac{2(n+3)}{3}\right] + 1 = \left[\frac{2 n}{3}\right] + 1 + 2$ right angles.

For $n = 5, \left[\frac{2 n}{3}\right] + 1 = 4$, if a pentagon has 4 right angles, then the other angle would be $(5-2) \times 180^{\circ} - 4 \times 90^{\circ} = 180^{\circ}$, which is impossible. Figure 3-16 shows a pentagon with three right angles.

Therefore, the answer to this problem is $k_{\max} = \left\{\begin{array}{l}3, n=5 ; \\ {\left[\frac{2 n}{3}\right] + 1, n \geqslant 6 .}\end{array}\right.$