Oh my bad I didn't even think to explain that part, but for example, if we have a slightly different integral such as the integral of (e^ix)/x from negative infinity to positive infinity we can rewrite it as f(z)=(e^iz)/z, which has a simple pole at the origin but is analytic everywhere else. So let's say we used the same contour as you did for your original integral (so the smaller semi-circle within the larger semi-circle) for this one.
Then the sum of all the individual contours that define this closed contour would be equal to zero, because there are no singularities within the closed contour in order for us to use residue theory with.
Now this is somewhat obvious but your original integral has a singularity within the closed contour, and as such the sum of all the individual contours will equal 2(pi)i*(sum of the residues).
So now it is just a matter of proving that your two semi-circle integrals go to zero, and to start with the larger one from -R to R, we can make use of Jordan's Lemma.
And actually, I am going to give a different example for this in order to show that the larger semi-circle goes to zero, and let you try to figure out the smaller semi-circle with some of the intuition you might pick up here(though if you are still stumped on the smaller circle then please comment and I will try to explain it). So the integral I will use is (cosx)/(x^2+1), where we rewrite it as f(z)=(e^iz)/(z^2+1) and use a semi-circular contour made up of two integrals, the semi-circle and the real axis. So we want to prove that the semi-circle integral goes to zero and that the real axis integral is the original integral(which I won't do here since you already know that). So we can rewrite (absolute value f(z) is |f(z)|, still not good with the math formatting, wanted to clarify) |f(z)| as |f(x+iy)| which is equal to (|e^ix*e^-y|)/|z^2+1| which is equal to (e^-y)/|z^2+1|, and in the upper half plane (y is greater than or equal to 0) we get |f(z)|=1/|z^2+1|.
Now with this what we want to do is bound the absolute value of the integral of the larger semi-circle (the circle from -R to R, with radius R) with a function that will include the singularity within our contour, for this example that singularity is i, so the function will become (pi)R/(R^2-1) where R is greater than 1. Now as R goes to infinity the new function we just made will go to zero and then, as a result, the semi-circle integral will go to zero as well because of the inequality.
All this being said hopefully I was able to help you out a little with this problem.