[proofplan]
The construction has three stages. First we shrink the open cover $(U_i)$ slightly: by induction on $n$ using the normality of $K$, we find open $V_i \subset \overline{V_i} \subset U_i$ that still cover $E$. Second we apply Urysohn's lemma to produce continuous bump functions $g_i$ with $\overline{V_i} \prec g_i \prec U_i$ and an auxiliary $g_{n+1}$ supported off $E$ that fills in the complement of the inner cover, so the sum $g := \sum_{i=1}^{n+1} g_i$ is at least $1$ everywhere. Third we set $h_i := g_i / g$; the strict positivity of $g$ makes the division continuous, and the bookkeeping yields $\sum_{i=1}^n h_i = 1 - g_{n+1}/g$, which equals $1$ on $E$ and lies in $[0,1]$ everywhere. Throughout we use that compact Hausdorff spaces are normal.
[/proofplan]
[step:Recall normality of $K$ and the inner-shrinking lemma]
Compact Hausdorff spaces are normal: any two disjoint closed sets in $K$ have disjoint open neighbourhoods. (Standard topology fact: in a compact Hausdorff space $K$, given disjoint closed sets $A, B$, for each $x \in A$ pick disjoint open sets $W_x \ni x$ and $W_x' \supset B$ by compactness of $B$ and Hausdorffness; finitely many $W_x$ cover $A$ by compactness of $A$, and the union is disjoint from the intersection of the corresponding $W_x'$.)
A consequence we use repeatedly: if $A \subseteq U$ with $A$ closed and $U$ open in $K$, then there exists an open $V$ with $A \subseteq V \subseteq \overline{V} \subseteq U$. Indeed, $A$ and $K \setminus U$ are disjoint closed sets; normality gives disjoint open sets $V \supset A$ and $W \supset K \setminus U$. Then $\overline{V} \subseteq K \setminus W \subseteq U$ (the complement of $W$ is closed and contains $V$).
[/step]
[step:Shrink the cover by induction to obtain $V_i$ with $\overline{V_i} \subset U_i$ and $E \subset \bigcup_i V_i$]
We build open sets $V_1, \dots, V_n$ such that $\overline{V_i} \subseteq U_i$ for each $i$ and $E \subseteq V_1 \cup \cdots \cup V_n$.
Set $A_1 := E \setminus (U_2 \cup \cdots \cup U_n)$. This is the part of $E$ that is forced into $U_1$. The set $A_1$ is closed (complement of an open set intersected with the closed set $E$) and contained in $U_1$ (since $E \subseteq U_1 \cup \cdots \cup U_n$). By the shrinking lemma from Step 1 applied to $A_1 \subseteq U_1$, there is an open $V_1$ with $A_1 \subseteq V_1 \subseteq \overline{V_1} \subseteq U_1$. Then
\begin{align*}
E \subseteq V_1 \cup U_2 \cup \cdots \cup U_n
\end{align*}
because $E \cap (K \setminus (U_2 \cup \cdots \cup U_n)) = A_1 \subseteq V_1$, and $E \cap (U_2 \cup \cdots \cup U_n) \subseteq U_2 \cup \cdots \cup U_n$.
Inductively, suppose we have constructed open sets $V_1, \dots, V_{k-1}$ with $\overline{V_i} \subseteq U_i$ and
\begin{align*}
E \subseteq V_1 \cup \cdots \cup V_{k-1} \cup U_k \cup \cdots \cup U_n.
\end{align*}
Set
\begin{align*}
A_k := E \setminus (V_1 \cup \cdots \cup V_{k-1} \cup U_{k+1} \cup \cdots \cup U_n).
\end{align*}
Then $A_k$ is closed and contained in $U_k$ (by the inductive cover). Apply the shrinking lemma to find an open $V_k$ with $A_k \subseteq V_k \subseteq \overline{V_k} \subseteq U_k$. Then $E \subseteq V_1 \cup \cdots \cup V_k \cup U_{k+1} \cup \cdots \cup U_n$.
After $n$ steps, $E \subseteq V_1 \cup \cdots \cup V_n$ with each $\overline{V_i} \subseteq U_i$.
[/step]
[step:Construct continuous bump functions $g_i$ via Urysohn's lemma]
Recall Urysohn's Lemma: in a normal topological space, for disjoint closed sets $A, B$, there is a continuous function $u: K \to [0, 1]$ with $u \equiv 1$ on $A$ and $u \equiv 0$ on $B$.
For $i = 1, \dots, n$: the sets $\overline{V_i}$ and $K \setminus U_i$ are disjoint closed sets ($\overline{V_i} \subseteq U_i$). By Urysohn's lemma applied to the normal space $K$, there exists $g_i \in C(K, [0,1])$ with $g_i \equiv 1$ on $\overline{V_i}$ and $g_i \equiv 0$ on $K \setminus U_i$. The latter gives $\{g_i \ne 0\} \subseteq U_i$, hence
\begin{align*}
\operatorname{supp}(g_i) = \overline{\{g_i \ne 0\}} \subseteq \overline{U_i}.
\end{align*}
We need the sharper bound $\operatorname{supp}(g_i) \subseteq U_i$. Apply the shrinking lemma to $\overline{V_i} \subseteq U_i$ to find an open $W_i$ with $\overline{V_i} \subseteq W_i \subseteq \overline{W_i} \subseteq U_i$. Re-running Urysohn with the closed sets $\overline{V_i}$ and $K \setminus W_i$ produces $g_i \in C(K, [0,1])$ with $g_i \equiv 1$ on $\overline{V_i}$ and $g_i \equiv 0$ on $K \setminus W_i$; then $\operatorname{supp}(g_i) \subseteq \overline{W_i} \subseteq U_i$, so $g_i \prec U_i$.
For the auxiliary function: set $W_0 := V_1 \cup \cdots \cup V_n$, an open set containing $E$ (Step 2). The sets $E$ and $K \setminus W_0$ are disjoint closed sets. Apply the shrinking lemma in reverse: $E$ is closed and $W_0$ is open with $E \subseteq W_0$, so there is an open $W'$ with $E \subseteq W' \subseteq \overline{W'} \subseteq W_0$. Urysohn applied to the closed sets $K \setminus W_0$ and $\overline{W'}$ gives $g_{n+1} \in C(K, [0,1])$ with $g_{n+1} \equiv 1$ on $K \setminus W_0$ and $g_{n+1} \equiv 0$ on $\overline{W'} \supseteq E$; in particular $g_{n+1} \equiv 0$ on $E$.
[/step]
[step:Verify the sum $g = \sum_{i=1}^{n+1} g_i$ is at least $1$ everywhere]
Define $g: K \to \mathbb{R}$, $g(x) := \sum_{i=1}^{n+1} g_i(x)$. Since each $g_i \in C(K)$, $g \in C(K)$.
Fix $x \in K$. Two cases:
**Case 1: $x \in W_0 = V_1 \cup \cdots \cup V_n$.** Then $x \in V_j$ for some $j \in \{1, \dots, n\}$, so $x \in \overline{V_j}$, hence $g_j(x) = 1$. The remaining terms $g_i(x) \ge 0$ contribute non-negatively, so $g(x) \ge 1$.
**Case 2: $x \in K \setminus W_0$.** Then $g_{n+1}(x) = 1$ (Step 3 construction). Again the other terms are non-negative, so $g(x) \ge 1$.
In both cases $g(x) \ge 1$. In particular $g(x) > 0$ everywhere on $K$.
[/step]
[step:Define $h_i := g_i / g$ and verify all required properties]
Since $g \in C(K)$ and $g \ge 1 > 0$ pointwise, the reciprocal $1/g \in C(K)$ (continuity preserved by division by a non-vanishing continuous function). Define
\begin{align*}
h_i: K &\to \mathbb{R} \\
x &\mapsto \frac{g_i(x)}{g(x)}, \qquad i = 1, \dots, n.
\end{align*}
Each $h_i \in C(K)$.
**$0 \le h_i \le 1$.** Since $0 \le g_i \le g$ pointwise (the inequality $g_i \le g = \sum_j g_j$ uses non-negativity of all $g_j$) and $g > 0$, $0 \le h_i \le 1$.
**$\operatorname{supp}(h_i) \subseteq U_i$.** $\{h_i \ne 0\} = \{g_i \ne 0\}$ (since $g > 0$), and $\overline{\{h_i \ne 0\}} = \overline{\{g_i \ne 0\}} = \operatorname{supp}(g_i) \subseteq U_i$ from Step 3. So $h_i \prec U_i$.
**$0 \le \sum_{i=1}^n h_i \le 1$ on $K$.** Pointwise,
\begin{align*}
\sum_{i=1}^n h_i(x) = \frac{\sum_{i=1}^n g_i(x)}{g(x)} = \frac{g(x) - g_{n+1}(x)}{g(x)} = 1 - \frac{g_{n+1}(x)}{g(x)}.
\end{align*}
Since $0 \le g_{n+1} \le g$, the ratio $g_{n+1}/g \in [0, 1]$, so $1 - g_{n+1}/g \in [0, 1]$.
**$\sum_{i=1}^n h_i \equiv 1$ on $E$.** For $x \in E$, $g_{n+1}(x) = 0$ (Step 3), so the formula above gives $\sum_{i=1}^n h_i(x) = 1$.
This completes the construction.
[guided]
The strategy mirrors the standard partition-of-unity construction on smooth manifolds, but in the topological setting Urysohn's lemma replaces smooth bump functions. The four ingredients are:
1. **Normality** (compact Hausdorff $\Rightarrow$ normal). This is what lets us separate disjoint closed sets by disjoint open sets, and equivalently shrink any neighbourhood of a closed set to a smaller one whose closure still lies inside.
2. **Cover shrinking** (Step 2). The original cover $E \subseteq \bigcup U_i$ is loose: the $U_i$ may overlap with $E$ on tiny pieces, and the supports we want must lie inside the $U_i$. Pulling each $U_i$ inward to a $V_i$ with $\overline{V_i} \subseteq U_i$ gives us a "buffer zone" between the support of $g_i$ and the boundary of $U_i$. The induction handles the bookkeeping: at step $k$, we use $V_1, \dots, V_{k-1}$ already constructed plus $U_{k+1}, \dots, U_n$ unshrunken.
3. **Urysohn's lemma** (Step 3). This produces the actual continuous functions $g_i$ taking value $1$ on $\overline{V_i}$ and $0$ outside (a small enlargement $W_i$ of $\overline{V_i}$ inside $U_i$).
4. **The auxiliary function $g_{n+1}$** is the crucial trick that separates this from the smooth-manifold construction. Without it, the sum $\sum_{i=1}^n g_i$ might be less than $1$ outside $\bigcup \overline{V_i}$, making division by $\sum g_i$ ill-defined or giving an unbounded normalisation. Adding $g_{n+1} \equiv 1$ outside $W_0 = \bigcup V_i$ fills the gap and makes $g \ge 1$ everywhere. The final formula $\sum_i h_i = 1 - g_{n+1}/g$ shows the partition of unity reaches $1$ exactly where $g_{n+1} = 0$, which by construction includes $E$.
Why $\operatorname{supp}(h_i) \subseteq U_i$ rather than just $\subseteq \overline{U_i}$? The strict containment matters because the inner shrinking of Urysohn's lemma uses an intermediate $W_i$ with $\overline{W_i} \subseteq U_i$. The function $g_i$ vanishes off $W_i$, hence $\operatorname{supp}(g_i) \subseteq \overline{W_i} \subseteq U_i$, strictly inside.
[/guided]
[/step]