Once you get into the (terrible, wonderful, costly) habit of buying yarn, you forget that there was a time when you didn't buy yarn. There was a time when the language of yarn was confusing and you didn't know how to get around a yarn store. Here is a guide for the new knitter on how to choose yarn.
Essential yarn vocabulary for yarn shopping
Gauge: How many stitches fit in one inch of knitting. For more on yarn gauge, see to save time check gauge.
Weight: How thick the yarn is. For more on yarn weights, see yarn weights terminology and us vs uk standards.
Fiber: What the yarn is made of. For more about yarn content, see yarn fiber.
Things you'll need to know
Gauge: The pattern will specify a gauge in sts per inch or per 4 inches. The yarn label will include the typical gauge on a recommended needle size. Some yarn labels will tell you the typical gauges on a range of needle sizes. The gauge on the label will not necessarily be the same as your gauge when you sit down to knit, don't forget that you will have to to save time check gauge.
The yarn store staff person may ask you what yarn weight you need. If you're not sure (and the most experienced of knitters may hesitate), you can tell them what gauge you need to achieve according to the pattern.
How much yarn you need: The pattern will either tell you how many balls or skeins you need in a particular yarn, OR, it will tell you how much yardage you will need. Unless you are using the exact brand and type of recommended yarn, you will need to make some calculations.
For example, the pattern may say something like this:
Size: xs (s, m, l, xl)
Yarn required: 5 (6, 7, 8, 9) balls of FancyPants DK (100% fancypants) 100 yards/50 g per ball
But you want to buy, say, JoeBlow Everyday DK which is 210 yards/100 g per ball.
So, calculate the yardage required for your size. Say you're knitting a medium, which needs 7 balls at 100yards = 700 yards needed. Divide the yardage by the per-ball yardage, 700/210 = 3.33. Round it up: you will need 4 balls of the JoeBlow yarn.
Things you'll have to decide
Yarn care: What are you willing to do? Or if you are giving the knitted item away, what do think you can rely on them to do? Some yarn must be hand-washed and carefully blocked. If that sounds like too much work, look for terms like "washable", "easy-care", "superwash". Most washing machines have a "handwash" or "delicate" setting, but it can be too rough on delicate fibers.
Price: How much do you want to spend? Before you fall in love with that hand dyed cashmere, figure out your budget. It's easy to fall under the spell of luxury yarn. But you don't need to spend a lot of money to make a nice garment. Find out where to get deals on yarn.
Color: Choose color that will be right for you. Pause and visualize that color on yourself. Yarn is an investment, pick something that you will want to wear. I still fall under the spell of colors I can't wear; for example, this 100% silk, raspberry pink. I have nothing in this color, it doesn't suit me, and yet I fell under its spell.
And another good thing to remember is that most yarn stores have a friendly return policy. Most will allow you to return full balls of yarn with their bands still on (but check with your local store for their policy).