What should I read to understand Kafka's religious motives in his works?
Start with Kafka's The Third Notebook in The Diaries of Kafka. In it he says:
Man cannot live without a permanent trust in something indestructible in himself, though both the indestructible element and the trust may remain permanently hidden from him. One of the ways in which this hiddenness can express itself is through faith in a personal god.
Kafka was Jewish, but in his diaries he wrote: "What do I have in common with the Jews? I don't have anything in common with myself, and would be content to stand quietly alone in a corner, satisfied that I can breathe."
Kafka was an existentialist, which means existence is all there is; there are no higher powers or a higher meaning to life.
What may have influenced Kafka more than religion was his illness. He died from tuberculosis, for which there was no cure in his era. TB is called a wasting disease, meaning you get progressively sicker and waste away. In Kafka's day it was called consumption because people who had it lost a lot of weight and seemed to be consumed by the illness. He lived every day in the shadow of death, so it is no wonder he portrayed life the way he did in his writings.