Define $(X, \mathcal{T})$ to be the topological space given by $X=\mathbb{R}\times\mathbb{Z}$, $\mathcal{T}$ the product of the usual topology on $\mathbb{R}$ with the cofinite topology on $\mathbb{Z}$. Let $\pi:X\to\mathbb{R}$ denote the canonical projection.
Consider the sets: $$N:=\bigcup_{k\geq 1} [0,1-1/k] \times \{k\}\quad\text{and}\quad M=N \cup \{(1,0)\}.$$
Prove that $M$ is compact but not closed and find its closure.
Given a closed subset $C\subset X$, prove that $C$ is compact if and only if $\pi(C)$ is bounded. Deduce that the closure of any compact set is compact.
Prove that $C\subset X$ is compact if and only if $\pi(C)$ is compact and $C \cap (\mathbb{R} \times \{k\}) $ is compact for all $k\in \mathbb{Z}$.
I have no problems seeing that the closure of $M$ is $\overline{M}=[0,1] \times \mathbb{Z}$, but I cannot figure out why it is compact. Also I see why $\pi(C)$ is bounded if $C$ is compact by the Heine-Borel theorem, but I do not see the other implication. Same with the third question - I see the left-to-right implication but not the reverse implication.
Some hints to start you off. Firstly, I think of $X$ like many "stalks", one for each copy of $\Bbb R$: you want to be thinking about achieving something for most of those stalks, and then sorting out the finitely many remaining stalks individually (it is dangerous to take that image too literally, since $\Bbb Z$ hasn't been given its discrete topology).
This mentality leads to a solution of question $(1)$ (which will help you address $(3)$ because the proofs are similar): mimic how we prove that the one-point compactification is genuinely compact, or how we prove that $\{0\}\cup\{1/n:n\in\Bbb N\}$ is genuinely a compact subset of $\Bbb R$ (without Heine-Borel). Given an open cover of $M$, take an open set that covers $(1,0)$: what remains of $M$ that is not covered? Not very much... only finitely many issues left to address. Oh, and question $(1)$ can be answered as a corollary of question $(3)$ if you're really stuck.
To be honest, figuring out why $N$ is not closed and $M=\overline{N}$ involves mostly the same trains of thought (for me) that you need to realise $M$ is compact.
For the other two questions:
Reminder: no, that doesn't automatically follow just because it's a projection map. It also doesn't automatically follow "because $\Bbb Z$ is discrete" because that is not how $\Bbb Z$ is being topologised here. EDIT: of course the Tube lemma is also applicable here. I managed to forget that the first time…
Mostly it is the proof of this that will get you thinking about how to solve the rest of the problem, it is not an especially useful result in itself (in my solution). That said:
A hint for question $(3)$: assuming the hypotheses on $C$ and given an open cover of $C$ in $X$, you can extract a finite subset of the cover that will cover most of $C$, that is, for all but finitely many integers $k$ we have covered $\pi(C)\times\{k\}$ (bundling most of the stalks together). The finitely many remaining "issues" can be addressed analogously to how they are addressed in the solution of $(1)$ (a finite union of compact sets is...).
Solution to exercise $\rm(i)$: