When I first started knitting, I dove right in. I was knitting cowls and shawls and toys, and lots of things where gauge didn't really matter-which was great because I had no idea what gauge was. I had seen mention of the terms gauge and swatching, but the thought of them left my mind as quickly as I'd read them. I generally just did what any given pattern called for, or completely ignored it because "it didn't matter" and I didn't have that needle size and was determined to cast on right that second using whatever I already had. But as I've grown as a knitter and taken on the task of educating myself on all things knit, I've learned that gauge does matter, to an extent.
So, what is gauge? Gauge is a reference to the number of stitches and rows that make up a square unit in a given pattern. It is affected by the yarn you use, the needles you use, the stitch pattern you work, how you're working [flat vs. in the round], and your tension as a knitter. Swatching is a way to determine your gauge before you start a project. It's done by using the yarn, needles, method, and stitch pattern called for by the project. For example, if I'm swatching for a pair of socks [which I currently am], I'm not going to work a flat swatch because I knit socks in the round. The difference in gauge between working flat and working in the round may be slight, but I want the closest representation of gauge possible, so working in your intended method is important [to see exactly how I swatched in the round, check my note below]. Similarly, swatching in pattern is important because knitting in stockinette will give you a different gauge than knitting in garter. Basing the gauge of one off of the other will give you an inaccurate count.
Why does is matter? When designers write a pattern they determine the number of stitches required based on a certain gauge. If I need the cuff of my sock to measure 9", I want to cast on the number of stitches in pattern per inch times 9 (less ease so your sock stays up). So if the design knits 8 sts per inch, but I only knit 6 sts per inch, when I finish my sock it will be more than 2" too small. That is a big deal.
So what can you do about it? Well, if you have fewer stitches than your target gauge, your stitches need to be bigger and you can try swatching on a larger needle. If you have more stitches than your target gauge, your stitches need to be smaller and you can try swatching on a smaller needle. [Also consider the weight of your yarn. If you're using a different yarn than your pattern calls for, it will affect your gauge and require your attention].
What about row count? This is the "to an extent part". What happens when you've adjusted your needle size to get the number of stitches per inch, but you haven't matched rows per inch. If you find that you have fewer rows per inch, you will simply have to work fewer rows to achieve the desired length, and if you have more rows per inch, you''ll have to knit more rows to reach length. You can also alter your blocking process to affect the dimensions of your finished garment, but this should not be your first plan of action.
So, swatch when fit is important. It doesn't have to be exact, but keep any discrepancy in mind as you knit your project. One thing to think about: don't assume that because you achieved gauge by sizing up or down for one project that you will achieve gauge for a different project by making the same modification. Just as your initial gauge may have varied from the pattern gauge, different designers will likely not knit to the same gauge either.
As a brand new knitter I thought a stitch was a stitch if knit by me or anyone else. They're not. Our knitting gauge is as unique as the knitters holding the needles. Take a look at this awesome post by Kelbourne Woolens as the explore the inherent variation in knitters' gauge.
Note: To swatch in the round I cast on the recommended number of stitches for gauge +2. I worked this number of stitches in the round for the recommended number of rows over three inches. Finally, I bound off as normal until the last two stitches. When I reached these final stitches I dropped them all the way down to the cast on edge, blocked the swatch as normal, cut the dropped stitches, and dried flat.
I've worked previous round swatches similar to an icord, leaving my yarn loosely draped behind each successive row, but I found this dropped stitch method is more conservative with yardage used [though swatching uses minimal yardage anyway].