This is question 7 on page 366 from section 58 of Munkres Topology:
Let $A$ be a subspace of $X$, let $j: A \to X$ the inclusion map, $f:X \to A$ continuous. Suppose there is a homotopy $H$ between $j \circ f$ and the identity on $X$.
a) Show if $f$ is a retraction, then $j_{*}$ is an isomorphism.
b) Show if $H$ maps $A \times I$ into $A$, then $j_{*}$ is an isomorphism.
c) Give an example where $j_{*}$ is not an isomorphism.
For part a, the book essentially shows how to do it for deformation retractions. Is the idea the same for general retractions? (compose, note one direction is the identity, the other direction is homotopic to the identity, etc...)
I'm not sure how to do part b. If $A$ is pointwise fixed, this is just equivalent to the notion of a deformation retraction, but I am not sure how to do it if the set itself is the only thing fixed.
For part c, I can think of some weird examples, but are there any very natural ones?
In both a and b, we have $j_*$ is surjective because for any element in $\pi_1(X)$ and loop in $X$ representing that element, the homotopy $H$ gives an explicit loop contained in $A$ which represents the same element in $\pi_1(X)$.
For injective, say we have two loops $\gamma_1$ and $\gamma_2$ contained in $A$ which represent the same element in $\pi_1(X)$. Let $h:S^1\times I \to X$ be a homotopy between them. We now split in cases depending on the condition, trying to prove that $\gamma_1$ and $\gamma_2$ are homotopic in $A$:
In a, we have that $f$ is a retraction, that is, constant on $A$. That means that applying $f$ to the loops $\gamma_1$ and $\gamma_2$ doesn't change them. Now $f\circ h$ is a homotopy between the circles completely contained in $A$, so $\gamma_1$ and $\gamma_2$ represent the same element in $\pi_1(A)$.
In b, the homotopy $H$ keeps $A$ inside $A$, but $f$ might not keep the loops fixed. In this case, some stitching is required. The map $f \circ h$ is a homotopy in $A$ between $f(\gamma_1)$ and $f(\gamma_2)$. Now by $H$, the loops $\gamma_1$ and $f(\gamma_1)$ are homotopic inside $A$, and the same for $\gamma_2$ and $f(\gamma_2)$. So by stitching together three different homotopies between four loops we have found that $\gamma_1$ and $\gamma_2$ are homotopic in $A$.
As for a counterexample, we have a few hints, the most important one is that no matter what we try, $j_*$ will end up being surjective. Now, the easiest surjective, non-injective group homomorphism is the trivial homomorphism $\Bbb Z \to 0$. So, in that spirit, let $X = \Bbb R^2$, $A$ an annulus and $f$ the constant map to some point in $A$.