Not a locally compact space that can be represented as union of two locally compact spaces (open and close) [R. Engelking, exercise 3.3.C] Define a subspace of the real line that can be represented as the union of two locally compact subspaces, one of which is closed and the other open, and that is not a locally compact space.
 A: Let $$A=(0, 1]\setminus\left\{\frac{1}{n}: n\in\mathbb{N}\right\}, \quad B=\{0\}.$$
the set $A$ is open and locally compact because it can be represented as union of open sets
$$A=\bigcup_{n=1}^\infty\left(\frac{1}{n+1}, \frac{1}{n}\right)$$
and for every point $x\in A$: $x\in \left(\frac{1}{n+1}, \frac{1}{n}\right)$ and
$\left[\frac{1}{n+1}, \frac{1}{n}\right]$ is compact.
The set $B$ is closed because it can be represented as complement of open set:
$$\{0\}=\mathbb{R}\setminus\left((-\infty, 0)\cup(0, +\infty)\right).$$
And $B$ is locally compact.
We are going to show that $X=A\cup B$ is not locally compact space.
Let us take any neighborhood $U$ of point $0$ in the topology of $X$.
Let us take a fundamental sequence $x_n$ in $U$
such that $x_n\to \frac{1}{k}$ in $\mathbb{R}$ for some $k\in \mathbb{N}$.
We can take such sequence because any neighborhood of $0$ has
infinitely many points of the form $\frac{1}{n}$ in $\mathbb{R}$.
Notice that $x_n$ hasn't limits in $U$.
And also it has no convergent subsequence in $U$ because otherwise, the limit should be equal to $\frac{1}{k}$
which does not belong to $U$.
Using this we can conclude that $U$ is not compact.
So, we have shown that every neighborhood of point $0$ is not compact in $X$.
That means that $X$ is not locally compact.
