In season 3, episode 5 of Survivorman, Les Stroud mentions the value of throwing cow dung, or any variety of others, on a fire to drive away insects. And he has "no idea why." Why does this work?
For mosquitoes, it probably works the same way DEET does, mosquitoes have the ability to smell and they really don’t like certain smells to the point that they will go away.
However, more recent evidence shows that DEET serves as a true repellent in that mosquitoes intensely dislike the smell of the chemical.
At the same time inhaling smoke isn’t very good for humans either.
There are other things like citronella candles that you can burn that will also keep the mosquitoes away and be far more pleasant smelling than burning cow poop.
I have no idea about whether it would keep other insects away such as ticks away.