Confusion about the proof that pseudo-compact implies compact . In If every real-valued continuous function is bounded on X (metric space), then X is compact. I get confused about Daniel Fischer's answer . (I have to write a new post since it is not enough reputation for me to comment in there ) 
Daniel Fischer said that since every point has a neighbourhood on which at most one $f_k$  attains values $\neq 0$ , then $f$ is well-defined and continuous.I have no idea what is going on and I thought it for a long time . Could someone tell me what is going on ?
 A: Let's split it up and decouple it from the "pseudo-compact implies compact" question.
1. Well-definedness:
Say you have a set $X$ (just a plain set, no metric nor other structure is considered here) and a sequence of functions $g_n \colon X \to \mathbb{R}$. Then one may want to consider the function
$$g \colon x \mapsto \sum_{n = 1}^{\infty} g_n(x)\,.\tag{1}$$
The question of well-definedness (of $g$) is whether the series $\sum_{n = 1}^{\infty} g_n(x)$ converges for every $x \in X$. If that is the case, then $g$ is well-defined (as a function $X \to \mathbb{R}$) by $(1)$.
If $X$ has many points, the behaviour of the series $\sum_{n = 1}^{\infty} g_n(x)$ can be very different at different points of $X$, and it can be quite cumbersome to check whether $g$ is well-defined by $(1)$. So it is useful to have simple criteria that tell us "if the $g_n$ satisfy some condition, then (1) makes sense for all $x \in X$". Every convergence criterion for real series gives such a criterion by making the condition uniform in $x \in X$, the most prominent example is the Weierstraß $M$-test

If there is a sequence $(M_n)$ of non-negative real numbers such that $\sum_{n = 1}^{\infty} M_n < +\infty$, and $$\lvert g_n(x)\rvert \leqslant M_n$$ holds for every $n \in \mathbb{N}$ and every $x \in X$, then the series $\sum_{n = 1}^{\infty} g_n(x)$ converges (absolutely) for every $x \in X$, and the convergence is uniform on $X$.

Of course there are many situations where such a strong premise doesn't hold. A different type of criterion is a pointwise finiteness criterion. This most often occurs in contexts where partitions of unity are used, but occasionally elsewhere. If the sequence $(g_n)$ is "pointwise finite" in the sense that for every $x \in X$ there are only finitely many $n$ with $g_n(x) \neq 0$, then $g$ is well-defined by $(1)$. We can state the finiteness condition as "for every $x \in X$ there is a $k(x) \in \mathbb{N}$ such that $g_n(x) = 0$ for all $n > k(x)$". Then for every $x \in X$ the sequence of partial sums
$$S_N(x) = \sum_{n = 1}^N g_n(x)$$
is eventually constant - we have $S_N(x) = S_{k(x)}(x)$ for every $N \geqslant k(x)$ - and hence convergent. This is the criterion I used in my answer.
2. Continuity:
If $X$ is a topological space (substitute metric space if you do not yet know about topological spaces), $g$ is well-defined by $(1)$, and all of the $g_n$ are continuous functions, the question arises whether $g$ is a continuous function too. The Weierstraß $M$-test yields the continuity of $g$ when its premises are satisfied, because it asserts uniform convergence, and the uniform limit of continuous functions is again continuous.
There is an important strengthening of the last observation. Since continuity is a local property - a function $f$ is continuous on $X$ if and only if for every $x\in X$ there is a neighbourhood $U_x$ of $x$ such that $f$ is continuous on $U_x$ - we can weaken the requirement of uniform convergence to locally uniform convergence. It suffices that every $x \in X$ has a neighbourhood $U_x$ such that the sequence/series converges uniformly on $U_x$ to conclude the global continuity of the limit function. For under this condition the limit function is continuous on $U_x$, and by the locality of continuity it follows that it is continuous everywhere.
The pointwise finiteness condition is not strong enough to guarantee the continuity of $g$, but a local finiteness condition is. If every $x \in X$ has a neighbourhood $U_x$ such that there is a $k(x) \in \mathbb{N}$ with $g_n(y) = 0$ for all $n > k(x)$ and all $y \in U_x$, then the series
$$\sum_{n = 1}^{\infty} g_n(x)$$
converges locally uniformly on $X$, and hence $g$ is continuous.
In this situation we have
$$g(y) = \sum_{n = 1}^{k(x)} g_n(y)$$
for all $y \in U_x$, and the series converges uniformly on $U_x$: Given $\varepsilon > 0$ we have
$$\sup_{y \in U_x} \: \Biggl\lvert g(y) - \sum_{n = 1}^N g_n(y)\Biggr\rvert = 0 < \varepsilon$$
for all $N \geqslant k(x)$.
