Example 8 Find the minimum value of $\frac{a}{\sin \theta}+\frac{b}{\cos \theta}\left(a, b>0, \theta \in\left(0, \frac{\pi}{2}\right)\right)$.
Let $\lambda_{1}, \lambda_{2} > 0$, by the Cauchy-Schwarz inequality we have:
\[
\left(\lambda_{1}^{2}+\lambda_{2}^{2}\right)\left(\sin ^{2} \theta+\cos ^{2} \theta\right) \geqslant\left(\lambda_{1} \sin \theta+\lambda_{2} \cos \theta\right)^{2}
\]
\[
\Rightarrow \sqrt{\lambda_{1}^{2}+\lambda_{2}^{2}} \geqslant \lambda_{1} \sin \theta+\lambda_{2} \cos \theta, \text{ equality holds when } \frac{\lambda_{1}}{\sin \theta}=\frac{\lambda_{2}}{\cos \theta}.
\]
Thus,
\[
\sqrt{\lambda_{1}^{2}+\lambda_{2}^{2}}\left(\frac{a}{\sin \theta}+\frac{b}{\cos \theta}\right) \geqslant\left(\lambda_{1} \sin \theta+\lambda_{2} \cos \theta\right) \cdot\left(\frac{a}{\sin \theta}+\frac{b}{\cos \theta}\right) \geqslant\left(\sqrt{a \lambda_{1}}+\sqrt{b \lambda_{2}}\right)^{2} \text{ (Cauchy-Schwarz inequality)}
\]
Equality holds when \(\frac{\lambda_{1} \sin ^{2} \theta}{a}=\frac{\lambda_{2} \cos ^{2} \theta}{b}\).

Therefore,
\[
\frac{a}{\sin \theta}+\frac{b}{\cos \theta} \geqslant \frac{\left(\sqrt{a \lambda_{1}}+\sqrt{b \lambda_{2}}\right)^{2}}{\sqrt{\lambda_{1}^{2}+\lambda_{2}^{2}}}
\]
From (1) and (2), the equality condition is:
\[
\left\{\begin{array}{l}
\frac{\lambda_{1} \sin ^{2} \theta}{a}=\frac{\lambda_{2} \cos ^{2} \theta}{b} \\
\frac{\lambda_{1}}{\sin \theta}=\frac{\lambda_{2}}{\cos \theta}
\end{array}\right.
\]
(4) Squaring and multiplying by (3): \(\frac{\lambda_{1}^{3}}{a}=\frac{\lambda_{2}^{3}}{b} \Rightarrow \frac{\lambda_{1}}{\lambda_{2}}=\frac{\sqrt[3]{a}}{\sqrt[3]{b}}\). Substituting into (4) gives \(\tan \theta=\frac{\sqrt[3]{a}}{\sqrt[3]{b}}\), i.e., when \(\theta=\arctan \frac{\sqrt[3]{a}}{\sqrt[3]{b}}\), \(\frac{a}{\sin \theta}+\frac{b}{\cos \theta}\) achieves its minimum value. At this point, \(\sin \theta=\frac{\sqrt[3]{a}}{\sqrt{\sqrt[3]{a^{2}}+\sqrt[3]{b^{2}}}}, \cos \theta=\frac{\sqrt[3]{b}}{\sqrt{\sqrt[3]{a^{2}}+\sqrt[3]{b^{2}}}}\),

Thus,
\[
\frac{a}{\sin \theta}+\frac{b}{\cos \theta} \geqslant\left(\sqrt[3]{a^{2}}+\sqrt[3]{b^{2}}\right)^{4},
\]
Hence, the minimum value of \(\frac{a}{\sin \theta}+\frac{b}{\cos \theta}, a, b > 0, \theta \in\left(0, \frac{\pi}{2}\right)\) is \(\left(\sqrt[3]{a^{2}}+\sqrt[3]{b^{2}}\right)^{4}\).