First you check
this thread to see which Gyms are available at the moment. Once you find the one you want you'll also have to check if their Queue is free. If it is, go to
this thread claiming you wish to get into That Gym Leader/Trainer's queue.
Also note that if that Gym has a Gym Trainer(s), you'll have to challenge them first before you can take on a Leader!