Even though there are a lot of good resources on the Internet covering this question, having hundreds of questions about the position of nicht is clearly evidence that this is a difficult topic. Hence I'm trying to elaborate on these specific examples.
Best way, I think, is coming from the positive statement.
Ich mache die Übungen.
This is easy, isn't it? I'm doing exercises. No doubt about that.
Now I can negate the whole sentence (or the statement, for that matter) by adding nicht to the end of the sentence. Think of it as stating the positive statement, and then negating it at once.
[Ich mache die Übungen] nicht.
I wouldn't say that you're negating the verb. You might say that you're just negating the phrase "die Übungen machen" (as opposed to the whole sentence including the subject), but that doesn't make any difference anyway.
What's for sure is that nicht precedes or follows the part it's negating immediately. Coming from that point of view, it must be either the noun phrase "die Übungen", the verbal phrase "mache die Übungen" or the whole sentence "Ich mache die Übungen nicht".
Now, we can drop the former one because when negating the noun, nicht precedes the noun. I'm afraid but that's basically language feel. But try thinking of it this way:
Ich mache [nicht A] [sondern B].
But (and this is a big one) when putting nicht between the verb and the noun you can negate both, verb and noun.
Ich mache nicht die Übungen, sondern lese sie nur.
Ich mache nicht die Übungen, sondern die Zusatzaufgaben.
I'm sorry the examples aren't that great.
Obviously, such a sentence needs context. If you ever merely say "Ich mache nicht die Übungen", you shouldn't be suprised if the other person responds with "Sondern?".
Whereas when saying "Ich mache die Übungen nicht", it's just the fact of you not doing the exercises.
Now, everything's different with the second example.
*Du kommst mit uns nicht.
That one is a bit awkward. It'd be okay if it were:
Du kommst mit uns nicht mit.
There you have a part of the separable verb mitkommen at the end of the sentence, and you negate the verb. Mitkommen => nicht mitkommen.
Du kommst nicht mit uns.
might need more context. If you're not coming with us, with who then? If you're not coming with us, then what?
But this is also an acceptable way of negating the whole statement, "Du kommst" => "Du kommst nicht.", with "mit uns" just being kinda an addendum. In the end, it's just an prepositional phrase that is not required.
*Ich mache. => Incomplete
Du kommst. => Complete
To cut a long story short, the only correct way is your second sentence.
You can also negate the subject, but I'm dropping this for the sake of shortness. giggle