As the Thanksgiving holiday approaches, there's a lot of talk about what we're thankful for. It's not a religious holiday (one thing many atheists and agnostics are thankful for). Thanksgiving isn't in holy books. It centres on getting together to eat yourselves silly.

If you're so inclined, Thanksgiving can be religious. Giving thanks is an excellent theme for prayers. It's a harvest festival, and in my California school we were taught to sing that God, our maker, doth provide the harvest. This meant no more to me than the part about all being safely gathered in ere the winter storms begin. Those weren't my beliefs, and that wasn't my climate. (Good song, though.)

But atheists, agnostics, and other non-devout people also feel the urge to give thanks. It's sometimes odd to hear this, because "thank" is a transitive verb. It takes an object, implying someone being thanked. Whom is an atheist thanking?

There are lots of work-arounds for this difficulty. Instead of thanking God, you can thank goodness or your lucky stars. You can just exclaim "thanks be!" You can thank specific people: thank Jim and Mary for bringing the marshmallow sweet potatoes; thank Pat for making the long drive; thank Ted for shutting the cat in the bedroom so the cat-allergic people can come. But for such wonders as health and friendship, assigning credit is more difficult. The best dodge is simply to say that you're thankful. Name what you're full of thanks for, without saying full of thanks to whom.

What it comes down to is that an atheist is generally thankful for good luck, serendipity. Luck is often personified, but I don't know anyone who believes in Lady Luck. "Somebody out there likes me!" people joke. Does it make sense to thank chance? "Thank you, dice!" "Thank you, California state lottery!" People do it all the time.

I suspect that the urge to give thanks is a hardwired thing that helps us live as social animals. It's part of a suite of perceptions and behaviours that enable reciprocity and altruism. The impulse to thank those who've done good things for us, which happens to help us live comfortably with each other, is extended to religious realms. Just as we seem to be hardwired to keep track of and punish those who cheat us, I suspect we're hardwired to keep track of and thank our benefactors.

So perhaps emotions encourage us to feel thankful even if we don't believe in a deity suitable for thanking. It doesn't make sense to thank chance, since chance didn't go out of its way for us. But though it's irrational to thank chance, I think there's intellectual value to acknowledging it.

In the endless wrangles about the relative roles of genes versus environment in making us what we are, chance sometimes doesn't get the credit it deserves.

Chance may be folded into the environment side of the equation, and geneticists recognise chance when they talk about genetic drift or founder effect. But in our lives – and especially when assessing the lives of others – we often forget chance's role. We inspect the lives of the poor, unsuccessful, and sick for signs of bad upbringing, lack of initiative, and shallow values, and neglect to examine the role of fortune. And what's merely annoying when we smugly observe our neighbors and think "that could never happen to me," is iniquitous when we bring it into public policy.

So if, in the general chitchat about thankfulness that comes at this time of year, our emotional heritage prompts atheists and agnostics to increase their intellectual focus on the role of chance – that's something I'm grateful for.