I'd like to know what technique/s to use to get both the most height, and the most distance from a dirt jump. The stock image below is the kind of dirt jump I'm referring to.
Regarding the picture: in the comment I said the rider isn't going high because of not trying hard enough, but on second thought the main reason for not being able to get proper air from such jump is that the lip is not steep enough; in fact the entire transition of that jump is rather mellow and not suited for height, you'd almost have to bunny hop out of it to go higher. The second jump on the pic seems better in that regard though it is hard to tell. For reference, something like this will launch you in the air no matter what: (sidenote: it takes a lot of practice to be able to build jumps like that, almost as much as it takes practice to be able to ride them:)
Now, the optimium between height and length can probably mathematically be derived but I don't know how. I do know in the end it is irrelevant: once you practiced enough sometimes you'll just want to flow through lines without going particularily high while other times you'll try to really boost it. Another thing to realize is that pure distance at itself is almost never the aim: you'll rather want the perfect distance to nicely clear the jump. And not much further than that or you'll land too deep into the transition of the landing which makes it hard to maintain speed.
As for the actual answer (finally): as said I cannot explain it very well, but to go heigh (on jumps as pictured above) you basically push the bike against the transition, somewhere in the center so well before the lip, using mainly (at least for me) legs and arms. Doing that pushes the bike somewhat in more in front of you and forces it to follow the an upwards direction of the jump, and your body follows that. I don't think there is any pulling up on the handle bars until you are airborne. On the contrary, pushing the bike into the transition means extending limbs. This is a pretty good illustration you can also check the rest of the explanation there:
Final note: I rode/ride quite some dirt and met many people and when talking about it is usually in rather vague terms like 'push the bike' etc. It is just hard to break down all steps because they happen so fast and as a consequence it is hard to explain it to others. Best thing you can do is watch fellow riders or watch films, eventually in slow motion to see what exactly happens. But even if you do that you'll need practice, practice and then some more practice and one day you'll realize you suddenly know how to do it. If you can then explain exactly why, please report back here!
That last photo from @stijn is a good illustration. See how the rider is crouched at the bottom of the transition with legs and arms bent. As he takes off his legs and arms are extended. That means that his centre of mass is moving more steeply up than the transition itself, and he pulls the whole bike up with him.
If he were speed jumping it he would be doing the opposite: his legs and arms would be straighter at the bottom of the transition, bending to absorb the jump as he went up the face, giving a much flatter trajectory.
You want to be careful of pulling up too hard in a jerky motion and stalling in the air. You need enough speed to get the distance, and then use the whole height of the takeoff to launch your whole body − don’t just pull on the bars.
Skilled riders don’t need a big takeoff to get height. Watch how someone like Danny Macaskill can use a small stone or tiny kicker to launch onto high ledges, etc. It’s kind of a bunny-hop with a boost.
Distance is more dependant on the speed of the rider and the shape of the takeoff. My memories of school physics tell me that a launch angle of 45° gives the greatest distance, but launching a bike from a dirt takeoff involves so many variables that I wouldn’t dwell too much on that number. As @stijn says, you’ll usually just want to aim for the sweet spot in the landing, whatever distance that may be.
(Relating to your other question about building dirt jumps: look at those shovels! Nice long handles, smooth curved backs, and see how that guy is using it on the face of that jump to compact it and smooth it at the same time.)