Existence of an open set which contains a compact subset In general metric space $X$, we know compactness implies boundedness and closedness(the other way around it's not always true).
If there exist a proper compact subset $E$ of $X$ and a point $x\in E^c$, we can easily form an open set $U$ s.t. $E\subsetneq U\subsetneq \bar{U}\subsetneq X$. (The construction of $U$ is similar to the step of finding a finite subcover in the proof of that compactness implies closedness.)
But if our space $X$ now is only locally compact and Hausdorff and $E\subsetneq  X$, $E$ being compact, can we still have the existence of such an $U$, i.e. can we still find an open set $U$ s.t. $E\subsetneq U\subsetneq \bar{U}\subsetneq X$?

Edit: I have proved the claim is true whenever $X$ is a locally compact Hausdorff connected space. For details please refer to my post.

Second edit: As @Henno commented, a connected metric space need not be locally compact at all.(cf. Michael's Answer in this post). The local compactness remains necessary as a separate assumption.
 A: Thanks to @Amsmath's counterexample, I found that connectedness is a necessary condition to my claim.
Hence, we suppose that our space $X$ is locally compact Hausdorff connected, which means $X$ is locally compact, Hausdorff, and connected. Suppose $E\subsetneq X$, $E$ being compact, nonempty.
We claim that there exists an open set $U$ s.t. $E\subsetneq U\subsetneq \bar{U}\subsetneq X$.
Proof:
Since $E\subsetneq X$, there exists $y\in X \setminus E$.
Since $X$ is Hausdorff, we can find open sets $U, V$ s.t. $E\subset U$ and $y\in V$. (This is an elementary result from general topology, which can be found in any textbook on basic topology.)

Proposition $4.30$ (p. $131$, Real Anlysis, Folland) : If $X$ is a locally compact Hausdorff space, $U\subset X$ is open, and $x\in U$, then there is a compact neighborhood $N$ of $x$ such that $N\subset U$.

*

*A detailed proof could be found in the refered book.

By Proposition $4.30$, there exists a compact set $F$ s.t. $y\in F \subset V$. Compact subset in Hausdorff space is closed.
So we have already had two separated compact subsets which are separated by two disjoint open sets. We therefore use Urysohn's Lemma to derive a continuous function $f\in C(X,[0,1])$ s.t. $f=1$ on $E$ and $f=0$ on $F$.
For a topological space $Z$, $Z$ is connected iff all continous functions from $Z$ to $\{ 0,1\}$ are constant, where $\{ 0,1\}$ is the two-point space endowed with the discrete topology.
$X$ is connected and we have a non-constant continuous function $f$ from $X$ to $[0,1]$ and $f$ can attain values $0$ and $1$, so we conclude that $\{ 0,1\}\subsetneq f(X)$, i.e. $f$ can attain at least a number $q$ with $0<q<1.$
Let $0<r<q.$
Note that $(r,1]$ is open in $[0,1]$.
$\Longrightarrow f^{-1}(\,(r,1])$ properly contains $E$, being open in $X$, nonempty.
Note that $F\cap f^{-1}(\,(r,1])=\emptyset$ since $f=0$ on $F$.
Hence, if we denote $f^{-1}(\,(r,1])$ by $V$, then we have shown that $E\subsetneq V \subsetneq X.$
For each $x\in E,$ we note that $V$ is a neighborhood of $x$. Appealing to Prop. $4.30$ one more time, we can find a compact neighborhood $N_x$ of $x$ with $N_x \subset V$.
Then $\{N_x^o \}_{x\in E}$ forms an open cover of $E$, where $N_x^o$ means the interior of $N_x$. So there exists a finite subcover $\{N_{x_j}^o \}_{j=1}^n$. Let $U=\cup_{j=1}^n N_{x_j^o}$. Then $E\subset U$ and $\bar{U}=\cup_{j=1}^n N_{x_j},$ where the last equality is true in locally compact topological space. We can also infer that $\bar{U}$ is compact since it is a finite union of compact sets.
Lastly, we have shown that there exists an open set $U$, s.t. $E\subsetneq U\subsetneq \bar{U} \subsetneq V \subsetneq X$. The first proper inclusion holds because $E$ is closed and $U$ is open and $E\subset U$ and $E$ can not be both open and closed by the connectedness of $X$.(the only sets which are both open and closed in a connected space are the whole space or the empty set.)
$\tag*{$\blacksquare$}$

Remark 1: In the proof of Prop. $4.30$, Folland has used the condition that $\partial U$ is nonempty. However, in general disconnected locally compact Hausdorff space, $U$ might be both open and closed, which forces $\partial U$ to be empty. But a trivial modification can be made to his proof to make the proposition remains valid.
Remark 2: If without the connectedness condition of $X$, we may not construct our desired $U$ by using the continuous function $f$ from Urysohn's Lemma. What can we derive is a much weaker result. If $E\subsetneq X$, and a finite set of points $\{m_i \}_{i=1}^k$, where $m_i \in X\setminus E$ for all $i$. Then by the treatment above and Urysohn's Lemma, we can have a continuous function $g$ from $X$ to $[0,1]$ with $g=1$ on $E$ and $g=0$ on $\cup _i m_i$. It seems like we cannot even find a useful set-contain relation.
A: For $X$ connected and LCH (locally compact Hausdorff ) we do have the strict inclusions you crave.
First we have $K \subseteq U \subseteq \overline{U} \subseteq V$ by the standard results for any $K$ compact and open $V$ around it, where I do assume $V \neq X$. (If you know $K$ has a compact neighbourhood $N$ inside $V$, then taking $U=\operatorname{int}(N)$ is enough for the first fact, which also shows we can assume $\overline{U}$ is also compact).
So the condition of connectedness then implies all these inclusions are strict or else we would have a non-trivial clopen subset of $X$ which cannot be ($K$ is compact and hence closed so cannot equal the open set $U$, etc.).
The only trivialities to avoid are $V=X$ and $K=\emptyset$, really. Use a modified argument if you need to cover these cases as well.
As a follow up to the comments: suppose $E$ is compact in an LCH space $X$, there is some $ f \in C_c(X)$ that is $1$ on $E$: this is trivial if $X= E$ and so $X$ is compact too as the constant function with value $1$ then works. So assume $E \neq X$ wlog.
Then let $\alpha X$ be the one-point conpactification of $X$ which is compact Hausdorff and so normal and we always have some point $\infty \in \alpha  X \setminus E$. ( take the conpactifying point if $X$ is not compact and any point not in $E$ otherwise) As $E$ is closed and $\alpha X$ is normal we have open neighbourhoods $U$ of $E$ and $V$ of $\infty$ that have disjoint closures. We can then define a Urysohn function $f$ that is $1$ on $E$ and $0$ on $\overline{V}$ and this function is as required (when we restrict it back to $X$ in the non-compact case of course); the support of $f$ is a subset of the compact $X \setminus V$.
A: Your claim is not even true for metric spaces. As a counterexample, consider the set $[0,1]\cup \{2\}$ in $\mathbb R$ and $E = [0,1]$.
