What is the most efficient way to ride up or down hills, and into or away from wind? I'm trying to work out how hard I should push myself when riding up or down a hill. Similarly, how hard should I push myself when riding into, or away from, or perpendicular to wind?

My aim is to arrive at a location in the shortest amount of time possible. I would assume that if I output more power going up a hill, then I would have to compensate by outputting less power going down the other side (let me know if you disagree). So, what is the most efficient way to achieve this aim? Is it better to work harder (and save time) up hills, or work harder (and save time) down hills. Similarly, how does wind affect this, both on the flat and concurrently? For the purposes of this question, assume I am riding by myself and hence ignore slipstreaming

Extra points for justification of your answer with links and/or physics. (N.B. there are no extra points.)
As you have guessed, it is better to work harder on the uphill and rest on the downhill. And as others have mentioned, whatever works for you on the uphill in terms of balancing high cadence and mashing is best. However, there are a few guidelines that you can follow to approach each situation in the most efficient manner possible.


Downhill: Since wind resistance is the biggest factor in reducing your speed in this situation, you simply want to be as aerodynamic as possible. Tuck yourself into an aero position. Basically, you want your upper body as low and horizontal as possible. Check out pro riders on the downhill of a mountain for visual aids. Use this opportunity to rest and only pedal in short bursts coming out of corners that you've had to brake for. 
Headwind: You want to maintain a somewhat aero position, so keep low. However, a complete aero tuck compresses your lungs in your abdomen and you can't breathe as fully as if you were sitting straight up. This means you'll need to find a balance between aerodynamics and being able to breathe efficiently while keeping up a constant cadence and pedal force. You'll also want to keep your arms farther apart because tucking them into the center also compresses your lungs within your chest. Most likely, you'll want to either be in your drops or hunched over a bit with your hands on the hoods.
Uphill and/or tailwind: You can pretty much treat these two the same way since wind resistance is less of a concern than your own aerobic fitness. Just sit up and keep your hands wide to keep your lungs as open as possible and pedal with whatever force and cadence works best for you. Studies confirm our everyday experience that standing while you pedal will increase your speed but is not sustainable for very long. You'll only want to stand up to maintain speed over short sections where the road rises steeply (or more steeply if you're already on a hill), when a brief gust of wind has slowed you down and then let up, or any other situation that briefly threatens to lower your otherwise sustainable speed. If you're running out of energy and only halfway up a hill, standing up won't help you.


Of course, in the real world you never have just a hill or just wind from the front or back. There are cross winds, cross-head winds, cross-tail winds, hills with wind from any direction, and everything in between. Add in traffic concerns, road conditions, etc., and you'll almost certainly have to find a balance between pedaling efficiency and dealing with the world around you. 

If you'd like to read more, there is a great article on cycling up and down hills: http://www.sportsci.org/jour/9804/dps.html.

And the ever helpful sheldonbrown.com has an qually excellent article on the effects of wind resistantce here: http://sheldonbrown.com/brandt/wind.html.