To figure out how many stitches to cast on for a hat:

Measure around head of which hat is to fit. (If a surprise, measure around the wrist and wrap the measuring tape around twice.)

Measure how many stitches per inch you get with the needles you will be using to make the hat. Or, in other words, knit up a swatch with the needles you plan to use.

Multiply the # of inches around the head by the number of stitches per inch. For example, if I got a person with a head circumference of 20 inches and I got 3 stitches per inch, it would look like this:
20 [U]x 3[/U] 60
Hope the tip helps!
PS  For children, I usually use a 16" size 11 circular needle and worsted weight yarn, and I CO 48 stitches.
Hope this helps!