This lemma is a variant of Lemma \ref{lemma-H1-O-picard-flat-proper} and we strongly urge the reader to read that proof first; this proof is basically a copy of that proof with minor modifications. It follows from the description of (scheme valued) points of $Z$ and the $Z_i$ that $Z \subset \bigcap_{i = 1, \ldots, n} Z_i$ where we take the scheme theoretic intersection. Thus we may replace $S$ by the scheme theoretic intersection $\bigcap_{i = 1, \ldots, n} Z_i$. After shrinking $S$ to an affine open neighbourhood of $s$ we may assume that $\mathcal{L}_i = \mathcal{O}_{X_i}$ for $i = 1, \ldots, n$. Let $E = Rf_*\mathcal{L}$ and $E_i = Rf_{i, *}\mathcal{L}_i = Rf_{i, *}\mathcal{O}_{X_i}$. These are perfect complexes whose formation commutes with arbitrary change of base (Derived Categories of Schemes, Lemma \ref{perfect-lemma-flat-proper-perfect-direct-image-general}). In particular we see that $$ E \otimes_{\mathcal{O}_S}^\mathbf{L} \kappa(s) = R\Gamma(X_s, \mathcal{L}_s) = R\Gamma(X_s, \mathcal{O}_{X_s}) $$ The second equality because $s \in Z$. Set $h_j = \dim_{\kappa(s)} H^j(X_s, \mathcal{O}_{X_s})$. After shrinking $S$ we can represent $E$ by a complex $$ \mathcal{O}_S \to \mathcal{O}_S^{\oplus h_1} \to \mathcal{O}_S^{\oplus h_2} \to \ldots $$ see More on Algebra, Lemma \ref{more-algebra-lemma-lift-perfect-from-residue-field} (strictly speaking this also uses Derived Categories of Schemes, Lemmas \ref{perfect-lemma-affine-compare-bounded} and \ref{perfect-lemma-perfect-affine}). Similarly, we may assume $E_i$ is represented by a complex $$ \mathcal{O}_S \to \mathcal{O}_S^{\oplus h_{i, 1}} \to \mathcal{O}_S^{\oplus h_{i, 2}} \to \ldots $$ where $h_{i, j} = \dim_{\kappa(s)} H^j(X_{i, s}, \mathcal{O}_{X_{i, s}})$. By functoriality of cohomology we have a map $$ E \longrightarrow E_i $$ in $D(\mathcal{O}_S)$ whose formation commutes with change of base. Since the complex representing $E$ is a finite complex of finite free modules and since $S$ is affine, we can choose a map of complexes $$ \xymatrix{ \mathcal{O}_S \ar[r]_d \ar[d]_{a_i} & \mathcal{O}_S^{\oplus h_1} \ar[r] \ar[d]_{b_i} & \mathcal{O}_S^{\oplus h_2} \ar[r] \ar[d]_{c_i} & \ldots \\ \mathcal{O}_S \ar[r]^{d_i} & \mathcal{O}_S^{\oplus h_{i, 1}} \ar[r] & \mathcal{O}_S^{\oplus h_{i, 2}} \ar[r] & \ldots } $$ representing the given map $E \to E_i$. Since $s \in Z$ we see that the trivializing section of $\mathcal{L}_s$ pulls back to a trivializing section of $\mathcal{L}_{i, s} = \mathcal{O}_{X_{i, s}}$. Thus $a_i \otimes \kappa(s)$ is an isomorphism, hence after shrinking $S$ we see that $a_i$ is an isomorphism. Finally, we use the hypothesis that $H^1(X_s, \mathcal{O}) \to \bigoplus_{i = 1, \ldots, n} H^1(X_{i, s}, \mathcal{O})$ is injective, to see that there exists a $h_1 \times h_1$ minor of the matrix defining $\oplus b_i$ which maps to a nonzero element in $\kappa(s)$. Hence after shrinking $S$ we may assume that $(b_1, \ldots, b_n) : \mathcal{O}_S^{h_1} \to \bigoplus_{i = 1, \ldots, n} \mathcal{O}_S^{h_{i, 1}}$ is injective. However, since $\mathcal{L}_i = \mathcal{O}_{X_i}$ we see that $d_i = 0$ for $i = 1, \ldots n$. It follows that $d = 0$ because $(b_1, \ldots, b_n) \circ d = (\oplus d_i) \circ (a_1, \ldots, a_n)$. In this way we see that the trivializing section of $\mathcal{L}_s$ lifts to a section of $\mathcal{L}$ over $X$. A straightforward topological argument (omitted) shows that this means that $\mathcal{L}$ is trivial after possibly shrinking $S$ a bit further.