Understanding of quotient space Suppose (X, A) has HEP and A is closed in
X. Let f : A → Y be any continuous map. Let W be the quotient space of X∐Y given by identifying each a ∈ A with f(a) ∈ Y.
I wonder how to understand quotient space there, what is the equivalence relation and equivalence class. Furthermore, can we prove Y is closed in W.
 A: 
I wonder how to understand quotient space there, what is the equivalence relation and equivalence class.

The construction you are referring to is known as adjunction space.
The equivalence relation on the disjoint union $X\sqcup Y$ is generated by $a\sim f(a)$ if $a\in A$ (and therefore $f(a)\in Y$). Meaning it is the smallest (in the sense of inclusion) equivalence relationship containing $a\sim f(a)$ for all $a\in A$. In particular if $f$ is injective then we only have $a\sim f(a)$ (and $f(a)\sim a$ by symmetry). But if $f$ is not injective, then the relationship is bigger: $x\sim y$ whenever $f(x)=f(y)$. This can be combined to:

*

*if $x\in X\backslash A$ then $[x]_\sim=\{x\}$

*if $y\in Y\backslash f(A)$ then $[y]_\sim=\{y\}$

*if $x\in A$ then $[x]_\sim=f^{-1}\big(f(x)\big)\cup\{f(x)\}=[f(x)]_\sim$.

In other words we take $X$ and glue its subspace $A$ to the image of $f$. How we do the glueing is given by $f$.
Example 1. Consider $X=Y=[0,1]$ and $A=\{0,1\}$. Take $f:A\to Y$ given by $f(0)=0$ and $f(1)=1$. So we glue ends of $X$ to ends of $Y$. The resulting space is a circle.
Example 2. Consider $X=Y=[0,1]^2$, $A=\{0,1\}\times[0,1]$. Define $f:A\to Y$ as follows: $f(0,t)=(0,t)$ and $f(1,t)=(1,-t)$. So we glue left edge of $[0,1]^2$ to itself directly, while we glue the right edge to itself by inverting direction. The resulting space is the Möbius strip.
Example 3. Let $X=(-\infty,0]\cup [1,\infty)$, $A=\{0,1\}$ and $Y=[0,1]$. Let $f:A\to Y$ be given by $f(0)=0$ and $f(1)=1$. So we simply add the missing interval in $X$. The resulting space is $\mathbb{R}$.
Example 4 ($f$ matters). The same setup as in $3$: Let $X=(-\infty,0]\cup [1,\infty)$, $A=\{0,1\}$ and $Y=[0,1]$. But now let $f:A\to Y$ be given by $f(0)=f(1)=1$. The resulting space is a disjoint union of two objects: the first one is a $(-\infty,0]$ line while the other one is $[1,\infty)$ line with a circle attached to $1$ (a.k.a. a lollipop).

Furthermore, can we prove Y is closed in W.

So first of all note that HEP is irrelevant here. And also $A$ does not have to be closed for the construction to work. However if $A$ is closed then $Y$ is closed in the quotient, which you can find here: Properties of a map (attaching map) to the adjunction space
A: You consider the adjunction space $Y \sqcup_f X$ (also written as $Y \cup_f X$). This construction works for arbitray pairs $(X,A)$, you do not need to assume that $(X,A)$ has the HEP or that $A$ is closed in $X$.
Start with the disjoint union $D  = X \coprod Y$ and define a relation $\sim$ on $D$ by
$$a \sim f(a) \text{ for all } a \in A .$$
This means "identifying each $a ∈ A$ with $f(a) ∈ Y$". The above relation $\sim$ generates an equivalence relation on $D$ which we again denote by $\sim$. What does this mean? Formally a relation on a set $M$ is a subset $R \subset M \times M$. An equivalence relation is a reflexive, symmetric and transitive relation $E$. This means

*

*$(x,x) \in E$ for all $x \in M$.


*If $(x,y) \in E$, then also $(y,x) \in E$.


*If $(x,y) \in E$ and $(y,z) \in E$, then also $(x,z)  \in E$.
Given any relation $R$ on $M$, the equivalence relation generated by $R$ is defined as the smallest equivalence relation containing $R$. Technically it is the intersection of all equivalence relations on $M$ containing $R$. It is easy to see that this intersection is an equivalence relation (anfd thus by definition the smallest equivalence relation containing $R$).
In the above case you can easily verify that $d \sim d'$ iff one of the following conditions is satisfied:

*

*$d, d' \in A$ and $f(d) = f(d')$


*$d, d' \in X \setminus A$ and $d = d'$


*$d, d' \in Y$ and $d = d'$


*$d \in A, d' \in Y$ and $f(d) = d'$


*$d \in Y, d' \in A$ and $f(d') = d$
Thus the equivalence classes in $X \sqcup_f X = D/\sim$ are

*

*the singletons $\{x\}$ with $x \in X \setminus A$


*the singletons $\{y\}$ with $y \in Y \setminus f(A)$


*the sets $\{ f^{-1}(y) \coprod \{y\}$ with $y \in f(A)$
In other words, $\sim$ collapses the sets  $\{ f^{-1}(y) \coprod \{y\} \subset D$ to points and leaves everything else unchanged.
The quotient map $p: D \to Y \sqcup_f X$ induces the quotient topology on $Y \sqcup_f X$. The function $i : Y \to X \sqcup_f X, i(y) = p(y)$, is trivially continuous (since $Y \to D = X \coprod Y, y \mapsto y$, is continuous). Clearly it is also injective. It is moreover an embedding. To see this, we have to show that the image $i(U)$ of each open $U \subset Y$ is open in the subspace $i(Y) \subset Y \sqcup_f X$:
$f^{-1}(U)$ is open in $A$; choose an open $V \subset X$ such that $V \cap A  = f^{-1}(U)$. Then $V \coprod U$ is open in $D$ and $p(V \coprod U)$ is open in $Y \sqcup_f X$ (because $p^{-1}(p(V \coprod U)= V \coprod U$). But $p(V \coprod U) \cap i(Y) = i(U)$.
Let us finally observe that $i(Y)$ is closed in $Y \sqcup_f X$ if $A$ is closed in $X$ because $p^{-1}(i(Y)) = A \coprod Y$ which is closed in $D$.
