All of them are fine. 

There is no particular interaction of the choice of forms with a _by_ expression. 

The difference between _had given_ and _gave_ is that with _had given_, the speaker is choosing to view the event from some later point in the past. With _gave_, no particular temporal viewpoint (or "story time") is set or used. 

So in 2, there is no "story time" set, and the narrative simply follows the events in order - first I give him the money, and then I go home. 

In 5. _had given_ is natural, because it is viewing the giving from a particular later time - the time when confirmed it. It's still not obligatory even in this case - we don't always use the past perfect when the temporal relationships are clear. But it's more natural. 

In 3, _had given_ makes clear that the time when (I realised) he wasn't pleased was later than the giving - if his displeasure was clear at the time of giving, I'd expect _he hadn't been pleased_. 

In 1 and 4, the events are being viewed from the time when I went home - presumably around 6 o'clock. 

**Edit**: I had (!) missed sentence 6. 
In 6, _had vanished_ is normal, because you're looking at the event from the time when somebody (possibly) told you. Again, it's not obligatory: the temporal relationships are clear, so people would often user the simpler _vanished_. But _had vanished_ is the most natural option here.