Preimage of compact set over fiberwise compact map Let $\pi:X\to Y$ be a conitionuis surjective map between two Hausdorff sapces $X,Y$. Suppose that for each $y\in Y$, the reimage $\pi^{-1}(y)$ is compact.
Question

Can we say that for each compact subset $B\subset Y$, the preimage
$\pi^{-1}(B)$ is also compact?

 A: No.
Consider $\operatorname{Id}\colon (\Bbb{R}, \tau_\text{discrete}) \to (\Bbb{R}, \tau_\text{euclidean})$ defined by $$\operatorname{Id}(x) =x$$

*

*$\operatorname{Id}$ is continuous onto (in fact bijective) map.


*$\operatorname{Id}^{-1}(\{x\})=\{x\} $ is compact.


*$\operatorname{Id}^{-1}([0, 1]) =[0, 1]$ is not compact.
Note :

*

*Any map defined on a discrete space is continuous.


*A subset of a euclidean space is compact iff closed and bounded.


*A subset of a discrete space is compact iff it is finite.
A: This answer is meant to extend that of Lost in Space. A map with your property, that preimages of compact sets are compact, is also called proper and there are conditions from which you can conclude it. The best one among them is:
Theorem: If $X$ is compact and $Y$ is Hausdorff, then a continuous map $f\colon X\rightarrow Y$ is proper (and also closed).
Proof: Let $C\subseteq Y$ be compact, then $C$ is closed (as $Y$ is Hausdorff), then the preimage $f^{-1}(C)$ is closed (as $f$ is continuous) and therefore compact (as $X$ is compact).
(Let $A\subset X$ be closed, then $A$ is compact (as $X$ is compact), then the image $f(A)$ is compact (as $f$ is continuous) and therefore closed (as $Y$ is Hausdorff)). $\square$
As you can see, given those conditions, the example of Lost in Space no longer works as $(\mathbb{R},\tau_\text{discrete})$ is not compact, which is exactly why the example works for your conditions.
