Before trying to answer the question I’ll reveal that I have been known to fill out a lottery form from time to time (although the last time that had happened was more than five years ago). I did it for a simple reason: I considered the thrill of anticipating the draw worth the minimum participation fee's investment in filling out the form.
Yet there are people out there who seriously fill out lottery forms under the expectation they could win the grand prize. The common attribute these people seem to share is their lack off statistical literacy, or – in other words – their ignorance in the ways of big numbers. It is simply very human and very intuitive not to be able to tell the difference between a one in million chance and a one in a billion chance even if, on paper, the difference is huge. The problem is obvious, and so is the solution: teaching people about the unintuitive ways of this world.
As it is, our educational system is failing us. It fails us so badly that even banks and major financial institutions seem to lack the numerical skills required in this day and age (as Cory Doctorow points out in his latest Guardian article here).
The other reason why people buy lottery tickets is them thinking the money won would help them sort all of this world’s problems out. Wrong! Turning into science provides the correct answer yet again, and as before this answer is rather unintuitive: once the basic needs of life are covered, more money shall not make you happier. Read here from Scientific American for more details.
My advice? If you’re into lottery crap, stop now; and if the money you're used to spending on the lottery burns a hole in your pocket, donate it to the likes of Médecins Sans Frontières: that would be putting your money into genuinely good use, for a change.