A loose toilet paper holder can be a real nuisance. It eventually will fall apart and someone will just stick the toilet paper on one of the arms sticking out from the wall. It is usually the case that one of the arms is loose from the wall. The way the arms are held in place is that there is a bracket that is secured to the wall, and then the arm is secured to the bracket with a small set screw.
You might get lucky and just have to tighten the setscrew. It is unlikely that this will totally fix the problem as it is usually the bracket that becomes loose from the wall…but you might get lucky.
To really fix the problem, you will have to loosen the set screw and remove the arm from the bracket. The set screw will be at the very bottom of the base of the arm where it meets the wall. The screw is very small and takes a standard screw driver.
When you get to the wall bracket you will see the screws holding it to the wall. In all likelihood the installer uses small plastic anchors that can’t withstand much stress. In this case, the screw will just turn and not tighten. If the bracket isn’t located over a wall stud (if it was the bracket would not be loose), use a toggle bolt (also known as a butterfly bolt). You will probably have to drill a larger hole in the wall to accept the head of the toggle, but it will hold tight. It is probably a good idea, depending on the shape of the bracket) to use two toggle bolts at opposing ends of the bracket.
Once the bracket is tight to the wall, replace the arm and tighten the set screw.