Example 6 Let $a, b, c$ be positive real numbers, and $abc + a + c = b$. Try to determine the maximum value of $P=\frac{2}{a^{2}+1}-\frac{2}{b^{2}+1}+\frac{3}{c^{2}+1}$.
(1999, Vietnam Mathematical Olympiad)
Given that $a+c=(1-a c) b$.
It is easy to see that $1-a c \neq 0$. Therefore, we have $b=\frac{a+c}{1-a c}$.
This structure reminds us of the tangent addition formula, hence we make a tangent substitution.

Let $a=\tan \alpha, b=\tan \beta, c=\tan \gamma, \alpha, \beta, \gamma \in\left(0, \frac{\pi}{2}\right)$. Then
$$
\tan \beta=\frac{\tan \alpha+\tan \gamma}{1-\tan \alpha \cdot \tan \gamma}=\tan (\alpha+\gamma) .
$$

Since $\beta, \alpha+\gamma \in(0, \pi)$, we have $\beta=\alpha+\gamma$. Therefore,
$$
\begin{array}{l}
P=\frac{2}{1+\tan ^{2} \alpha}-\frac{2}{1+\tan ^{2} \beta}+\frac{3}{1+\tan ^{2} \gamma} \\
=2 \cos ^{2} \alpha-2 \cos ^{2}(\alpha+\gamma)+3 \cos ^{2} \gamma \\
=(\cos 2 \alpha+1)-[\cos (2 \alpha+2 \gamma)+1]+3 \cos ^{2} \gamma \\
=2 \sin \gamma \cdot \sin (2 \alpha+\gamma)+3 \cos ^{2} \gamma \\
=2 \sin \gamma \cdot \sin (\alpha+\beta)+3 \cos ^{2} \gamma \\
\leqslant 2 \sin \gamma+3\left(1-\sin ^{2} \gamma\right) \\
=\frac{10}{3}-3\left(\sin \gamma-\frac{1}{3}\right)^{2} \leqslant \frac{10}{3} .
\end{array}
$$

Equality holds if and only if $\alpha+\beta=\frac{\pi}{2}, \sin \gamma=\frac{1}{3}$, i.e., $a=\frac{\sqrt{2}}{2}, b=\sqrt{2}, c=\frac{\sqrt{2}}{4}$. Thus, $P_{\max }=\frac{10}{3}$.