How to determine true wind direction......... sail close hauled on port and starboard tack, note each course on the boat compass, not the handheld..... then average the two readings. If you know true wind direction, you can put the boat at 45 degree wind angle and do a simple vector calculation (hah, hah) or... heave to for a moment.
Keep track of each heading on each tack... to determine wind shifts.
That's the essence of the tactical electronic compasses, such as the tacktick products.
For instance, if you sail close hauled on starboard with your heading at 315, then tack over to port and sail close hauled at 45, then you would have a true wind direcection of 360 or 0 deg. If you note a +5 degree change on starboard then you know the true wind has shifted also....in this case a lift....
Compare the boat's heading to the true wind direction to determine true wind angle when incorporating your polar data as exampled in Jackdaw's piece on VMG strategy.
Sailing off the wind is similar but you find the optimal wind angle and seek the target speed..... comparing that to the polar figure. Then, when you jibe over, you seek the same speed number.... and note the wind angle... same as going up wind, changes will alert you to wind shifts.
Obviously, it's important to log the data for ongoing analysis to aid your decision making.