It's the 'counting' part that helps - the subject matter doesn't really matter at all. Part of the difficulty in getting to sleep occurs if your mind is busy working on events that have happened during the day, or on a particular problem you are experiencing. The notion of counting concentrates your mind on a repetitive function, clearing other thoughts, and relaxing you. The repetition is soothing, and the continued relaxation usually results in sleep.
A recent scientific study was done and it proved that people who count sheep actually take longer to fall asleep because it keeps the brain working. The best way to fall asleep is to imagine waves lapping on the beach.
Bit of a problem here, your brain will invent stuff to think about if you don't 'use' it, but if you start thinking about stuff to cope with this it'll create other linked thoughts. So you need to do something with your brain, but at the same time not do anything that will lead to related thoughts. Solution? Keep saying 'THE' to yourself, over and over again. It works.
I start at the beginning of the alphabet and try to think of as many first names as I can and then go on to 'b', and so on. I don't usually get very much further than 'h' before I drop off to sleep. Yes, my brain is working but not doing it's usual worrying. Anyway, it helps me!
Counting sheep NEVER works for me. Stupid as it sounds I start worrying they might be cold in the field, then they all move about and i worry i missed one!!! Slighty strange but it keeps me awake...i just think of simple things that keep me happy, like shoes and bags, then i normally drop off relaxed and happy!