Patterns tell you how many sts per inch you need and give you the number of stitches for different sizes. Or you can cast on about 20 sts and knit a few inches to see how many per inch you get. Which size needle depends on the yarn and how tight or loose you knit, or how tight or loose you want the items to be. Lace shawls for example are often knit with sock yarn. Socks should be tightly knit to wear longer so one ould use size 1 to 3 on them. But for a lacey shawl, you can use up to a size 10 with the same yarn for a light airy knit.
If you knit a bulky yarn on size 8s, it’s going to be very dense and hard on your hands to knit, but if you use size 11 to 15, it’s going to be more appropriate for the bulk.