I have come across this problem in a set of exercises leading to a proof of the Jordan Normal Form. It begins with taking a polynomial $h(x)$ such that $h(L)\equiv 0$ for a linear operator $L$, and factoring it as $(x-\lambda_1)^{n_1}\dotsm(x-\lambda_k)^{n_k}$. Then define the polynomial $g_i(x)=\prod_{j\neq i}(x-\lambda_j)^{n_j}$.
The exercise: Given the $k$ polynomials $g_i(x)$, show that there exist polynomials $f_i(x)$ such that $\sum_i f_i(x)g_i(x)=1$. (There is a hint: what is the greatest common factor of the $g_i$'s?)