Ralph feels compelled to continue to be the leader because he is more responsible and more ethical than Jack. He knows the boys need his influence and he knows he is the one who is their only hope of maintaining order. He is the one who stresses the need to keep the fire going and he, along with Simon, is the one who makes it a priority to build shelters. Given his attention to the fire, he realizes his leadership offers them their best chance of being rescued.
The two boys that stick with Ralph, even when Jack lures most of the boys to his camp, are Piggy and Simon. Piggy is intelligent and knows that Ralph is the more sensible, fair leader. He also knows that since Ralph is so insistent on keeping the fire going, Ralph wants to be rescued. So does Piggy. Clearly, Jack doesn't like Piggy because he thinks Piggy is weak. Jack is a bully and Piggy is the type of person Jack likes to pick on. So, Piggy naturally gravitates to Ralph who does stand up for him.
Simon is the spiritual, peace-loving character in the novel. It therefore makes sense that he would favor Ralph over Jack because Jack is much more interested in hunting and violence. Even after Simon is killed, Ralph still reluctantly tries to be a leader. His camp is down to Piggy and some of the little ones. Ralph is determined but by this point, he is also frustrated and scared. He knows that the boys in Jack's camp will no longer obey him and the order that the conch represents. Yet he still intends to try to keep the fire going. In the early part of Chapter 10, Ralph confesses his fears to Piggy. "I’m frightened. Of us. I want to go home. Oh God, I want to go home."