Solution (source code)

= Solution

The <product topology> on $X\times Y$ has the <open> rectangles $U\times V$, with $U$ <open> in $X$ and $V$ <open> in $Y$, as a <topological basis>. The projection preimages are $p_X^{-1}(U)=U\times Y$ and $p_Y^{-1}(V)=X\times V$, so both projections are <continuous>.

If $f:Z\to X\times Y$ is <continuous>, both coordinate compositions are <continuous>. Conversely, if both are <continuous>, then
$$
f^{-1}(U\times V)=(p_X\circ f)^{-1}(U)\cap(p_Y\circ f)^{-1}(V)
$$
is <open> for every basic rectangle, proving <continuity> of $f$. Given <paths> between two chosen endpoints in each factor, their coordinatewise pair is therefore a <continuous path> in the product, proving that a product of <path-connected spaces> is <path-connected>.

For the compact-neighborhood assertion, fix $x\in K$. For each $y\in L$, choose an <open> rectangle $U_y\times V_y$ containing $(x,y)$ inside $W$. <Compactness> of $L$ chooses finitely many $V_{y_j}$ covering $L$. Put
$$
U_x=\bigcap_jU_{y_j},\qquad V_x=\bigcup_jV_{y_j}.
$$
Then $x\in U_x$, $L\subseteq V_x$, and $U_x\times V_x\subseteq W$: any point of $V_x$ belongs to one of those rectangles' second factors, while $U_x$ lies in every first factor.

<Compactness> of $K$ now selects finitely many $U_{x_i}$ covering $K$. <Set>
$$
U=\bigcup_iU_{x_i},\qquad V=\bigcap_iV_{x_i}.
$$
These are <open>, contain $K$ and $L$, and if $(u,v)\in U\times V$, choose an $i$ with $u\in U_{x_i}$ and use $v\in V_{x_i}$. Hence
$$
\boxed{K\times L\subseteq U\times V\subseteq W.}
$$
If $K$ or $L$ is empty, take the corresponding <open> factor empty and the other factor the whole space; the assertions then hold directly. No <Hausdorff> assumption on the factors is needed.