I'm trying to understand why the induced map $i_*: \pi_1(A) \rightarrow \pi_1(X)$ is surjective, for $A$ being a retract of $X$ and $i: A \rightarrow X$ being the inclusion map? For homotopy retracts it's obvious, but for retracts it seems I miss something.
[Math] Induced homomorphism between fundamental groups of a retract is surjective
algebraic-topologyfundamental-groups
Related Solutions
Consider $i$ canonical injection $i\colon A \to X$. The fact that $r$ is a retract means $$r \circ i = \mathrm{id}_A$$ From this we get $$r_* \circ i_* = \mathrm{id}_{\pi_1(A)}$$ and this implies $r_*$ surjective since it has a right inverse.
The point is that, even if two classes $[f]$ and $[g]$ are different in $\pi_1(X,x_0)$ (that is, $f$ and $g$ are not homotopic in $X$), it can be the case that $[f]=[g]$ in $\pi_1(Y,x_0)$ (when $f$ and $g$ are homotopic in $Y$).
Indeed, when you write "$i_*([f])=[f]$" (which is true!), the "$[f]$" on the left side is different from the "$[f]$" on the right side, even if you write them with the same symbol: the one on the left side is the class of the loops (on $x_0$) homotopic (relatively to $x_0$) to $f$ in $X$, while the one on the right side is the class of the loops homotopic to $f$ in $Y$.
For instance, consider the inclusion $i$ of $D\setminus \{p\}$ into $D$, being $D$ a disk and $p$ one of its points. Let $f$ be a loop on a fixed $x_0 \in D\setminus \{p\}$ such that $f$ goes around $p$. Then clearly $[f]\neq[\sigma_{x_0}]$ in $\pi_1(D\setminus \{p\})$, but of course $[f]=[\sigma_{x_0}]$ in $\pi_1(D)$. Here $\sigma_{x_0}$ denotes the constant loop on $x_0$. Hence in this case $i_*$ is not injective. And indeed $D\setminus \{p\}$ is not a retract of $D$!
Edit. I rewrite everything with the clarifying notation.
The point is that, even if two classes $[f]_X$ and $[g]_X$ are different in $\pi_1(X,x_0)$ (that is, $f$ and $g$ are not homotopic in $X$), it can be the case that $[f]_Y=[g]_Y$ in $\pi_1(Y,x_0)$ (when $f$ and $g$ are homotopic in $Y$).
Indeed, when you write "$i_*([f]_X)=[f]_Y$" (which is true!), the "$[f]_X$" on the left side is different from the "$[f]_Y$" on the right side: $[f]_X$ the one on the left side is the class of the loops (on $x_0$) homotopic (relatively to $x_0$) to $f$ in $X$, while $[f]_Y$ is the class of the loops homotopic to $f$ in $Y$.
For instance, consider the inclusion $i$ of $D\setminus \{p\}$ into $D$, being $D$ a disk and $p$ one of its points. Let $f$ be a loop on a fixed $x_0 \in D\setminus \{p\}$ such that $f$ goes around $p$. Then clearly $[f]_{D\setminus\{p\}}\neq[\sigma_{x_0}]_{D\setminus\{p\}}$ in $\pi_1(D\setminus \{p\})$, but of course $[f]_D=[\sigma_{x_0}]_D$ in $\pi_1(D)$. Here $\sigma_{x_0}$ denotes the constant loop on $x_0$. Hence in this case $i_*$ is not injective. And indeed $D\setminus \{p\}$ is not a retract of $D$!
Best Answer
Any loop in $A$ is also a loop in $X$. What does $f_*$ do to an element of $\pi_1(X)$ that is a loop in $A$?
More categorically, if $i:A\to X$ is the inclusion map (so that $f\circ i=\mathrm{id}_A$), then $f_*\circ i_*=\mathrm{id}_{\pi_1(A)}$ because $\pi_1$ is a functor. Since $\mathrm{id}_{\pi_1(A)}$ is surjective we must have that $f_*$ is surjective.
Regarding your edited question, the map $i_*:\pi_1(A)\to \pi_1(X)$ does not have to be surjective, regardless of whether or not there is a retraction $f:X\to A$.
For example, let $X$ be any space with a non-trivial fundamental group and let $A=\{x\}$ be a point in $X$. There is an obvious retraction $f:X\to A$ (the constant map to $x$). But $\pi_1(A)$ is trivial and hence $i_*:\pi_1(A)\to\pi_1(X)$ cannot be surjective.