I can pretty much get by laning phase without any problems, but during team fights I can hardly be useful. I mainly have two issues, first one being that usually team fights are so clumped up and crowded that I end up blowing abilities on tanks etc, my second issue is actually related to team-fight knowledge what exactly do specific roles be doing in team fights. I understand that carries should be focusing other carries and tanks should be protecting their carries, but what about other roles?
It depends on who you are playing and how you build them. A tanky champ with spammable CC(Udyr, Olaf) should be stunning or snaring as many people as possible, for instance.
A quick answer is whatever you do well in lane, you will do well in a teamfight. Importantly, you need to do SOMETHING in a team fight. There is nothing more frustrating or useless than someone that just spins around during a team fight without using their abilities.
Additionally, don't worry too much about attacking tanks unless you are very mobile with a reliable gap closer that can get you into the back line(Nocturne, Irelia.) It is way worse to die out of position, having done nothing, than it is to kill a tank and get out safely.
There is a mob mentality in normals and low Elo that "ur bad" if you attack a tank. However, if their front line is impossible to get past without dying, it only makes sense to hit what you can. Still, be aware of which enemy is the best target. Often you will have a choice between two or sometimes three tanky champs. Pay attention during the game to who is least farmed and punish them in team fights.
As a ranged carry, be aware that the enemies gap closers will attempt to engage on you. If this happens, do your best to separate and try to kite towards someone that can peel them off if you.
AP carries should know their best combo and only employ their long CD cults when a team fight is truly engaged. Blowing Brands ult early, for instance, could allow the enemy team to retreat safely, heal up, and reengage on better terms.
If you're playing an initiator(Amumu, Malphite, etc.) you have to understand when the enemy is in a disadvantaged position and take advantage of it.
tl;dr: In a team fight, do whatever your champ does best when not in a team fight. They are often the same thing!
For the first part of the question, you should just practice and over time, your reflexes will improve and you'll be able to target the carries. For the second part, in my opinion,
I think this covers all of the main roles.