Solution (source code)

= Solution

Use integral <cohomology> and let $k\geq1$. On the <projective bundle> $Y=\mathbb P(E)$ define the <complex tautological line bundle>
$$
\mathcal L=\{(\ell,v):\ell\subset E_x\text{ is a complex line},\ v\in\ell\}\subseteq\pi^*E.
$$
Put $t=e(\mathcal L)\in H^2(Y;\mathbb Z)$, using the canonical complex orientation. On each fibre, $t$ is the <Euler class> of the tautological line over $\mathbb{CP}^{k-1}$, so $1,t,\ldots,t^{k-1}$ restrict to an integral basis of its <cohomology>.

Here is the finite-cover <Leray-Hirsch theorem> proof in this case. For each open set $U\subseteq X$, define
$$
\Phi_U:\bigoplus_{i=0}^{k-1}H^{q-2i}(U;\mathbb Z)\longrightarrow H^q(\pi^{-1}U;\mathbb Z),\qquad(u_i)\longmapsto\sum_i\pi^*u_i\smile t^i.
$$
If $E$ is trivial on $U$, its <projective bundle> is $U\times\mathbb{CP}^{k-1}$ and $\mathcal L$ is pulled back from the tautological line on the second factor. The <Künneth theorem> makes $\Phi_U$ an isomorphism, since the fibre has finite free integral cohomology. The same holds for every open subset of $U$.

Compactness of $X$ provides a finite trivializing cover $U_1,\ldots,U_N$. Induct on its size. If the result holds on $V=U_1\cup\cdots\cup U_{N-1}$, it holds on $U_N$ and on $V\cap U_N$, both lying in a trivializing chart. Form the diagram of <Mayer–Vietoris sequences> for the base, with the finitely many degree shifts on the left, and the total space on the right. Naturality of pullback and multiplication by the global even-degree classes $t^i$ makes the diagram commute. The <Five lemma> gives the isomorphism on $V\cup U_N$. Thus
$$
\boxed{H^*(Y;\mathbb Z)=\bigoplus_{i=0}^{k-1}\pi^*H^{*-2i}(X;\mathbb Z)\,t^i.}
$$
This is the claimed <free module> statement, with its graded degree shifts made explicit.

The module basis expresses $t^k$ uniquely using the lower powers, with homogeneous coefficients. Define the <Chern classes> $c_j(E)\in H^{2j}(X;\mathbb Z)$ by the unique relation
$$
\boxed{f(t)=t^k-\pi^*c_1(E)t^{k-1}+\pi^*c_2(E)t^{k-2}+\cdots+(-1)^k\pi^*c_k(E)=0.}
$$
The pullbacks are suppressed when $f$ is regarded as a polynomial over $H^*(X)$. Evaluation at $t$ gives a surjective map $H^*(X)[T]\to H^*(Y)$. Since $f(T)$ is monic, <monic polynomial division over a ring> writes any polynomial as $q(T)f(T)+r(T)$ with degree of $r$ below $k$. If its evaluation is zero, module independence forces every coefficient of $r$ to vanish. Hence the kernel is exactly the ideal generated by $f$, proving
$$
\boxed{H^*(\mathbb P(E);\mathbb Z)\cong H^*(X;\mathbb Z)[T]/(f(T)).}
$$
The even-degree coefficients are central in the <graded commutative algebra>, so this division and ideal statement also apply when the base has odd-degree cohomology. Uniqueness of the coefficients proves their naturality under pullback, by pulling back the relation and using the same module basis. With the hyperplane convention $u=-t$, the relation has the usual all-positive Chern coefficients; the alternating signs here correspond to the tautological line itself.

Now suppose $E=\bigoplus_iL_i$. The <sections of a projective bundle> $s_i:X\to Y$ choose the line $(L_i)_x\subset E_x$. They satisfy $s_i^*\mathcal L\cong L_i$, so $s_i^*t=e_i$ and pulling back the relation gives $f(e_i)=0$.

To obtain the full factorization over the possibly torsion-containing base ring, also use the associated open charts
$$
V_i=\{\ell\in\mathbb P(E):\ell\to(L_i)_{\pi(\ell)}\text{ has nonzero coordinate projection}\}.
$$
They contain the images of the sections $s_i$ and cover $Y$. Projection identifies $\mathcal L|_{V_i}$ with $\pi^*L_i|_{V_i}$, so $t-\pi^*e_i$ restricts to zero on $V_i$. The <long exact sequence> of the pair lifts this class to $H^2(Y,V_i)$. The <relative cup product> of the $k$ lifted classes lies in
$$
H^{2k}(Y,V_1\cup\cdots\cup V_k)=H^{2k}(Y,Y)=0.
$$
Its absolute image is $\prod_i(t-\pi^*e_i)$, so that product vanishes. The polynomial $\prod_i(T-e_i)$ is monic of degree $k$ and lies in the kernel of evaluation. Subtracting the monic generator $f(T)$ leaves degree below $k$, and module independence again makes the difference zero. Therefore
$$
\boxed{f(T)=\prod_{i=1}^k(T-e_i),\qquad c_j(E)=\sum_{i_1<\cdots<i_j}e_{i_1}\smile\cdots\smile e_{i_j}.}
$$
The open-cover argument proves the factorization without a non-zero-divisor assumption on the differences $e_i-e_j$.