Tiki,
Upwind, indeed there are infinite courses, however typically there is only one optimum course (in some cases there are more but they are usually very similar). Upwind, you can sail at different courses (angles) to the true wind (ig. 30 deg. true, 35 deg. true, 40 deg. true). For each of these you will have a certain velocity. Now you do the trig. for each course and velocity and get the component vector towards the windward mark (0 deg. true). Now, based on the speed you can achieve for each course, there will be one optimum component velocity (Velocity made good). The course off of true wind with the highest velocity made good is your optimum course. These all may differ for different windspeeds. This is typically how Target boat speeds and courses are derived on big boats. They also have the advantage of a polar diagram usually created from a velocity prediction program which essentially does all of the math for them. Conversely, you can figure the same downwind.
Now, the second question - Upwind you want to sail towards the shift. I think i've typed too much on this response already so you could read Rick's book for a more thorough explanation...