My current D&D character, a human barbarian named Krusk Bloodfist, has recently discovered three reasons why he should study religion, some of which are better than others. The first reason is probably then best one. It is to express gratitude for divine aid. Recently, Krusk has seen many events that he considers miraculous. It was shortly after witnessing the first few of these events that he decided to seek out religious mentor to teach him how to thank the god that he believed was responsible for the miracles.
The second reason Krusk saw to be religious is to avoid curses. One of the "miracles" Krusk saw was actually a fatal misfortune to one of his mortal enemies. Someone hostile to Krusk and his friends suddenly and unexplainably contracted a terrible illness that cost him his life. At the time, it seemed pretty obvious that this condition was a curse inflicted on this enemy for his poor behvior, giving Krusk an additional reason to make sure his own behavior is acceptable.
The third reason was discovered just tonight in our weekly D&D game. Krusk's religious mentor, Sandra, was kidnapped, and now Krusk and his friends are going to try to rescue her, and you can be that Krusk will ask for help in doing so. Seeking divine aid is one of the main reasons people turn to religion, and while it's not the best reason to become religious, it's not the worst reason either. Arguably, to thank and to become more like God are among the best reasons to worship Him, while trying to avoid punishment may be one of the worse reasons, but if seeking blessings and avoiding punishments were bad reasons to be religious, I'm not sure God would have told us anything about the blessings or punishments we can gain or avoid in the first place. Sure, there are better sources of motivation, but I don't think God would have told us about them if He didn't want us to be motivated by them.
There are many reasons to b religious, some better than others, but when it comes to doing the right thing, just about any reason or reasons can be good enough.