Let $\pi: X \times Y \to X$ be the projection map where $Y$ is compact. Prove that $\pi$ is a closed map.
First I would like to see a proof of this claim.
I want to know that here why compactness is necessary or do we have any other weaker condition other than compactness for the same result to hold.
There is a standard example for why some hypothesis on $Y$ is necessary: let $X=Y=\mathbb R$, and consider the closed subset $F=\{(x,y)\in \mathbb R\times\mathbb R:xy=1\}\subseteq\mathbb{R}^2$. What is its projection to the first factor?
In fact, one can prove that a space $Y$ is compact iff for all spaces $X$ the projection $X\times Y\to X$ is closed. So while compactness is not necessary (I think...) for the closedness of the projection for one $X$, it is necessary if you want all such projections to be closed.
As for the proof you want in the first bullet point... this is a standard exercise in topology: what have you tried?