So you've been out all day, playing in the water and the wind has been great. Now it is getting a little late and your thinking its time to go home. It is then you realize that you are way downwind from where you want to go and you are probably thinking it just might be easier to walk up the beach. Well, if your in a hurry you're probably right, but what good is that. You windsurf because you like to sail so lets get there that way.
The most important thing is to keep your speed up so you plane well; it's much harder (and less fun) to slog upwind. You must point up as close to the wind as possible but maintain your plane. This often means pointing closer and closer until you start to lose your plane, then falling off (turning a bit downwind) to rebuild your speed.
The second thing is to let your board heel to leward (that is, sink the downwind edge a bit). This lets you use the whole leward rail (well, as much as is in the water) to provide lateral resistance instead of just your fin. The problem I found was that heeling to leward causes your board to turn downwind (normal foot steering when planing). The trick here is to rake your rig back towards the tail in order to move the sails' center of effort back, which tries to turn you upwind. Balancing these lets you plane in a straight line with the board heeled to leward.
The last thing is to use the right fin. I was amazed to discover recently how much easier it is to go upwind with a slightly larger pointer fin. The pointer, however, is too much fin for high winds (5.0 or better), so it is a good idea to have a nice quiver of fins. For those light days a 40cm pointer fin should do the job, and for high winds a 30cm speed or pointer fin would be fine. Remember, fin sizes are determined by your sail size and wind. For example, on a 7.5 day a 40cm fin is perfect, but if you are getting over powered and you begin to tail walk, a 38cm fin may solve your talk walking and you can still use the 7.5 without a loss of power. If you are spinning out that means that the fin is not big enough to handle the pressure the sail is exerting on the board so you will need a larger fin, assuming your technique is good.
A nice little trick to help you in those higher winds where you are riding the fin, is to actually pull the nose to windward with your front foot in the front strap. You don't need a lot of pressure to get a few extra degrees of pointing ability. This will only work when you are planing in the straps, but do not over do this because you will stall the board. Just to practice you should try to stall the board so that you can find the optimal angle of attack for your board and fin. Another tip is that more out haul will usually allow you to point slightly higher than if you bag out your sail. A smaller issue is that in choppy water, you can increase your speed and thus how high you can point by steering around the bigger waves rather than just plowing over them.
When the wind is marginal it is much harder to stay on a plane and accomplish what is described above however don't fret, there is a solution. This will not be the fastest method but you will point higher and therefore make better progress. The trick is just about the "anti" of the advice above. What you need to do is sink the windward rail instead of the leward rail, sheet out a little more than you would normally and the rig should be upright. This is because over sheeting in light wind kills your speed and we wouldn't want to do that.
Finally: practice, practice, practice...