This is the basis of cargo cults, similarity or sympathy rituals, and the odd little 'magic phrases' that children repeat to themselves in the hope that something particular and out of the usual will happen. It is the reason why some people repeat prayers without thinking, or play with fetishes or talismans.
My cat does it too. He walks to his food tray and expects fresh food to appear. If it doesn't, he runs back to me and taps my ankles. Then he runs back again and looks to see if any new food has arrived.
I wondered where I'd seen this before. Then I realized: people obsessed with their email and other internet-linked activities do this as well.