Understanding the Principle
Let's start by understanding the mechanism of a gravity assist. As a spacecraft approaches a planetary body, it gets affected by the planets gravitational pull. Getting nearer, the pull increases, and eventually when the spacecraft passes the planet, the pull decreases.
If you think about a stationary planet as an absolute frame of reference, picture throwing a body near it. The body will curve towards it, accelerating, then pass it, and then carry on, eventually retaining its original speed.
However as you know, planets are not stationary but rather, they orbit around the Sun at speeds to the order of tens of kilometres per second. Hence any spacecraft affected by the planets gravity, is affected by its orbital speed too.
Let's use a simple analogy.
Imagine a girl on a merry-go-round. She is sitting on the edge, with
her hand stretched out, and the the merry-go-round is rotating at a
certain speed counter-clockwise. You throw a ball at her hand. She
catches it for but a second, and then lets go. The ball is observed to
accelerate during this process.
In this analogy, the girl was a planet, the merry-go-round was her orbit, and her hand was the gravitational pull of that 'planet'. This is highly simplified explanation that serves only to explain the directions involved. If you throw a ball from behind her as she moves away from you, the ball will accelerate.
It's very easy to now imagine the inverse of this analogy; what if you throw the ball to the girl head on, as she comes closer to you. You can intuitively tell that the ball will decelerate during this process.
There are many other analogies, like a ping-pong ball hitting a ceiling fan, or a skateboarder grabbing a car on a round-about. The spacecraft is basically stealing the angular momentum of the planet.
Once you have these basics down, the rest of gravitational mechanics are easy to comprehend. The following diagram will show you the change in direction observed in an accelerating assist.
A more complex representation of what a gravity assist looks like when the planet is approached from behind. (Wikimedia)
On a (slightly) Larger Scale
For a real-world example, take Cassini-Huygens (my favorite spacecraft). Cassini's mission plan looked like this:
Orbital diagram of the path Cassini took to eventually reach Saturn (Wikimedia)
Cassini made a total of four flybys, all to gain speed. From what we've learnt earlier, acceleration occurs when we approach a planet from behind. Take a closer look at the diagram above and you can see that all the assists approached their respective planets from behind them in their orbits. This is the fundamental principle of gravity assists, observed in the real world.
Cassini's speed plotted over time, with the gravity assists labelled. Using multiple assists shaved off as much as 5 km/s ∆V for the mission, when compared to a simple Hohmann transfer. (Wikimedia)
I hope this clarifies the concept of a gravitational assist for you. The first two examples you gave -- Moon to escape Earth, Venus to reach Jupiter -- an accelerating assist is required and you should approach the planet from behind. For the last example -- from Venus down to Mercury -- you need to decelerate the spacecraft, and Venus should be approached head on
A couple of diagrams to show you in the clearest way possible, how gravity assists work.
The simplest form of an accelerating assist. (Courtesy Planetary Society)
Some of the possible forms of a gravity assist. (Courtesy Planetary Society)