I have a quite interesting problem that I have to solve, and there're way too many conditions that I can't put all together.
The problems is following:
Let $X$ be a Tychonoff space (i.e. completely regular space, i.e. space with $T_1$ and $T_{3\frac12}$ separation axioms).
Let $f: X \to Y$ be a continuous function with the following conditions:
$(\forall y \in Y)f^{-1}(y)$ is compact in $X$;
$f$ is a closed mapping, i.e. $\forall F \subset X$, if $F$ is closed in $X$, then $f(F)$ is closed in $Y$;
$f$ is surjective.
And I need to conclude that $X$ is homeomorphic to a closed subspace in $Y \times K$, where $K$ is some compact.
What I've already done: First, it's easy to understand, that $$X= \bigcup \limits_{y \in Y} f^{-1}(y)$$ is a partition of $X$, and and all the sets $f^{-1}(y)$ are closed compacts in $X$.
Even more, is't easy to understand that $Y$ is also a $T_1$ space.
And also, I understand that if we call $X/{\sim}$ a quotient-space of $X$ generated by a partition $X= \bigcup \limits_{y \in Y} f^{-1}(y)$, then $X/{\sim}$ is homeomorphic to $Y$.
But I don't know what's to do next. I understand that if $Y=\{y\}$ is a singleton, then the case is trivial since $X$ is compact itself and homeomorphic to $X \times Y$.
But even in the case when $Y=\{y_1, y_2\}$ I'm stuck.
Def. The map $f$ is perfect if it has compact fibers (a fiber is set of the form $f^{-1}(y)$), is surjective and closed.
Thus you want to prove that if $f:X\to Y$ is perfect, $X$ is Tychonoff, then there is compact space $K$ with $X$ embedding as a closed subspace into $Y\times K$.
Let $K$ be a compactification of $X$ and let $h:X\to Y\times K$ be the map $h(x) = (f(x), x)$. Such space $K$ exists because $X$ is Tychonoff.
Then $h$ is injective and continuous.
Lemma. If $g:X\to Y$ is closed, $g^{-1}(y)\subseteq U$ and $U$ is open, then there exists open $V$ with $g^{-1}[V]\subseteq U$ and $y\in V$.
Theorem. $g:X\to Y$ is perfect and $X$ is Hausdorff, then $Y$ is Hausdorff.
Proof: If $y_1, y_2\in Y$ are distinct, then $g^{-1}(y_1), g^{-1}(y_2)$ are disjoint compact sets in $X$ so we can find disjoint neighbourhoods $g^{-1}(y_1)\subseteq U, g^{-1}(y_2)\subseteq V$. Thus there exist open $U_0, V_0$ with $y_1\in U_0, y_2\in V_0$ and $g^{-1}[U_0]\subseteq U, g^{-1}[V_0]\subseteq V$. Then $U_0, V_0$ are disjoint neighbourhoods of $y_1, y_2$. $\square$
Closed graph theorem. If $g:X\to Y$ is continuous and $Y$ is Hausdorff then $\text{graph}(g)$ is closed in $Y\times X$.
The graph of $f\restriction_A:A\to Y$ is closed in $Y\times A$, so that its closed in $Y\times X$ if $A$ is closed. In other words, $h[A] = \{(f(x), x) : x\in A\}$ is closed for every closed $A\subseteq X$. Thus $h$ is an embedding into $Y\times X$.
Note that $Y\times K\setminus h[X] = \{(y, z)\in Y\times K : \{z\}\cap f^{-1}(y) = \emptyset\}$. If $(y, z)\in Y\times K\setminus h[X]$ then find open disjoint $U, W\subseteq Z$ such that $f^{-1}(y)\subseteq U$, $z\notin U, z\in W$. Such exists because $f^{-1}(y)$ is compact. From above lemma, find open $V\subseteq Y$ such that $f^{-1}[V]\subseteq U$ and $y\in V$. Then $f^{-1}[V]\cap W = \emptyset$, that is to say $(y, z)\in V\times W\subseteq Y\times K\setminus h[X]$. This shows that $h[X]$ is closed in $Y\times K$.