Let's head back to the basics first. If you know the basics already just skip to the next paragraph. It's quite simple to attack a gym. Just be in the area of the gym and click on it. You can now see what's in it and attack it by clicking on the fight icon in the bottom right. Select your 6 Pokemon and you can start attacking. Short taps are for a quick attack, a long tap is for a special attack. You can only perform a special attack when at least one of the blue bars is filled in the top left. Swipe either to the left or the right to dodge an attack. This might be hard in the beginning.
Till this point you may have attacked all gyms just with your best Pokemon or the Pokemon which were in your deck automatically. However, choosing your own deck might be the best choice if you have some knowledge of the different Pokemon types. You can select the type of Pokemon which are very effective agains the Pokemon which are in the gym you're going to attack at that very moment.
Also you can profit from waiting to use a special attack sometimes. When you're battling with a water type pokemon against a ghost pokemon and you have your special attack ready you can wait if you know there's a Magmar upcoming. Using your special attack against that Pokemon will be twice as effective as using it against the ghost type Pokemon.
Did you enjoy reading this post? Make sure to let me know in the comments! Have you been playing Pokemon GO as well? The comments section is the place to tell your adventure!
Also I'd like to know what Pokemon you use to attack gyms and I'd really like to know what Pokemon you leave in the gyms behind so make sure you include that in a comment as well!