$$A(n^3+3n^2-5) + B(n+2) = 1$$
This isn't a blueprint for a general method of finding a solution. I am going to take advantage of the fact that the second polynomial is $n+2$, a first degree polynomial.
Let $m = n+2$. Then
$$n^3+3n^2-5 = (m-2)^3+3(m-2)^2-5 = m^3 - 3m^2 -1$$
So we need to solve
$$A(m^3 - 3m^2 -1) + B(m) = 1$$
If we let $A=-1$, we get
\begin{align}
A(m^3 - 3m^2 -1) + B(m) &= 1 \\
-1(m^3 - 3m^2 -1) + B(m) &= 1 \\
Bm &= m^3 -3m^2 \\
B &= m^2 - 3m \\
B &= (n+2)^2-3(n+2) \\
B &= n^2 + n - 2
\end{align}
It is easy to check that
$$A(n^2 + n - 2) + B(n+2) = (-1)(n^3+3n^2-5) + (n^2 + n - 2)(n+2) = 1 $$