There are a number of things you need to keep in mind when figuring how many squares you'll need to make an afghan or blanket.
1. Make several squares in the pattern you've chosen.
2. Block and measure the squares. Blocking is especially important when assembling a blanket out of squares. It's one of the few times I actually block my work. The time and headache saved in assembly more than makes up for what you spend blocking. I have photos and written instructions on the process I follow here.
3. Decide how you're going to assemble your squares. The assembly method you choose will affect the finished size of your blanket. Whipstitching or single crocheting the blocks together won't afect the size much. But joining with a decorative stitch can affect the outcome. Even just a 1/4" added on a join can add 4 - 5" to the overall size of a king blanket using 4" squares. So if you're choosing something fancy like that you're going to have to piece a few together to figure out what the size is of your blocked, assembled square.
4. Divide the length and width of the blanket you want to make by the size of your finished squares (including whatever you added for assembly). This probably won't be a round number, so you'll have to decide whether you want to round up and make a slightly larger blanket, or round down & make a slightly smaller blanket. (Keep in mind that if you round down you can add a decorative border.) Then multiply the number of squares you need across by the number of squares you need for the length and you'll have the total number of squares you'll need to make.