Welcome to knitting!
About the leg warmers. Needle size matters, but mostly because that needle size [U]may[/U] give you gauge. Gauge is the number of stitches per inch and sometimes number of rows per inch (not always critical) that the designer worked the item at. You need to get the same gauge they did, although you may need to use a different needle size (diameter) to get that number of stitches/rows per inch.
Many people need to use a different needle size than is called for to get the gauge given, but you need to get gauge so that the item will fit. Sometimes gauge can be off a bit and everything will be fine, like for scarves, etc. where “fit” doesn’t really apply. The needle size given works for a lot of people though and is a good place to begin doing gauge swatches. Everyone knits a little differently so needles needed can vary.
When it says Gauge is 8 rows, 5 stitches per inch, it means that you need to knit on needles that will give [U]you[/U] 5 stitches (the part parallel to the needle holding the stitches) per inch. It usually helps to do the gauge over the number of stitches that should give you 4 inches. Like when it says 5 stitches=1 inch, cast-on 5X4 or 20 stitches (those 20 stitches should end up 4 inches wide). Most gauges are given over 4 inches or 10 cm which is the same thing. You also need to knit to 8 rows (the stitches as they run perpendicular to the needle). Again, this is usually given over 4 inches so it would be 4X8=32 rows. But like I said row gauge may not be important, in many patterns you can just go by inches knit and don’t have to worry about row gauge, but sometimes it is important.
Where it gives the gauge part of the pattern, you can take that out after you get the gauge figured out. But…with some yarns it is important to wash the gauge swatch before you measure it because the yarn changes when washed, then you don’t use it over, I guess. I never use those kinds of yarn.
Gauge is very important in knitting. Do a search here and elsewhere about knitting gauge and how to measure it. Learning all you can will save you a lot of grief.