Here is a simple fact, which seems to be well known to homotopy theorists. It might come in handy.

Suppose that we have two fibrations

$$ f:Y\to B,\;\; \pi:E\to B, $$

such that $E$ is contractible. The pullback to $Y$ of the fibration $\pi: E\to B$ via the map $f$ is a new fibration $g: X\to Y$. Then the homotopy fiber $Z$ of $Y\to B$ is homotopic to $X$.

Indeed we have a fibration $F:X\to E$ with t homotopy fiber $Z$. Since $E$ is contractible we deduce that $X$ is homotopic to $Z$.

This is particularly useful when $X\to Y$ is a principal $G$-bundle classified by a map $f: Y\to BG$. The map $f$ can be assumed to be a fibration. The homotopy fiber of $f$ is then $X$. From the Leray-Serre spectral sequence we obtain a spectral sequnce converging to the cohomology of $Y$ with $E_2$-term

$$E_2^{p,q}= H^p\bigl(\;BG, \tilde{H}^q(X)\;\bigr), $$

where $\tilde{H}^q(X)$ denotes a local system on $BG$ with stalk $H^q(X)$.