@Jacksoja: The crucial thing to understand is that if $m$ and $n$ are relatively prime, then $x\cong 0\pmod{mn}$ is equivalent to $x\cong 0\pmod m$ and $\x\cong 0\pmod n$. After that you can see that what's going on is solving two simultaneous congruences and using linearity.
@Jacksoja let's just do it for two ideals for simplicity, you can generalize it inductively in a straightforward manner from there. If $R$ is a ring and $I$ and $J$ are ideals, then we always have a map $R \to R/I \times R/J$, $r \mapsto (r+I,r+J)$. The kernel of that is $I \cap J$, so we get an injective map $R/I \cap J \to R/I \times R/J$. If $I+J=R$, then this maps is surjective, so an isomorphism
and furthermore if $R$ is commutative, then $I+J=R$ implies $I \cap J=IJ$
so if you apply that to $R=\Bbb Z$ and $I=(n)$ and $J=(m)$ for two coprime integers $n$ and $m$, we get an isomorphism $\Bbb Z/(nm) \cong \Bbb Z/n \times \Bbb Z/m$
Does the homomorphism defined this way have a name? "Let $\psi$ be the function that sends each element of $A$ to the identity expect elements of the subgroup $B$, upon which it acts as the identity function."
Well, I have this claim that $\psi f\neq\phi f$ unless $\psi=\phi$ (where $\psi,\phi,f$ are homomorphisms) and I'm trying to make the claim that this means $f$ must be onto.
My thought was to explicitly construct homomorphism which don't agree on the entire domain, but do agree on $\text{Im}(f)$
Nope and nope on those topics. Also, I managed to get an answer I was happy with on the divisibility one, but I could post my proof to get some pointers on it
suppose $f:G \to H$ is a homomorphism that is not surjective, then consider $H *_{f(G)} H$ and take $\psi$ and $\phi$ be the inclusions into the two components
then by construction $\psi \circ f= \phi \circ f$, but $\psi \neq \phi$
the situation is this: you have a group $C$ that is simultanously a subgroup of $A$ and $B$
then if $A=\langle S_A \mid R_A\rangle$ is a presentation and the same notation for $B$, then the amalgamated free product is $\langle S_A \cup S_B \mid R_A \cup R_B \cup C\rangle$