Guide to Alert Pings?
Hitting just G or V without dragging the mouse will show the standard blue/yellow pings. These don't provide much information but they are a start. Tagging an enemy with a blue ping (G) will target them letting your team know they're are a priority. It will even show a target above their head for everyone on your side. Tagging an enemy with yellow (V) shows the opposite of that and tells your team to retreat from that champ. You can hit G, V, CTRL, or ALT and a direction to show the following pings. Note it says G-direction but as above you can use any of those keys to replace G.
G-up gives the danger ping similar to just pressing V and shows a red exclamation point. Use this to tell teammates to fall back from an area. Or use it on an enemy champion to tell your team to avoid them.
G-right gives the On My Way alert and will draw a green line from your hero to the location where you pinged (Note this just draws the shortest way to that location and does not necessarily show the path you are currently taking). Use it as a jungle or while roaming as mid to let your lanes know you are coming in for a gank.
G-down is the Assist Me ping and shows up as a blue flag. Use it to let your jungler know you need help with your lane opponent. Also can be used later if you get caught out and need your team to come and try to save you.
G-left signals Enemy Missing displayed as a question mark. Use it to show your lane opponent may have left lane to gank another.
Of course these aren't the only situations you would use these pings in however. There is plenty of times to use any sort of ping depending on situation.
NA Forums link to the smart ping system
"G"-Alert ping "V"-Retreat ping
Just pressing these will ping regularly, when holding them down you open the smart ping menu where you can choose specific ping commands.
If you alert on a gem it will tell your team what type of gem it is. Likewise if you ping a tower it shows a defense (team) or offensive (enemy) sign.
The 2nd part of the question is harder to answer, it mostly comes down to experience. You have to know the difference between good and bad situations. Other then that there are many cases you want to alert your team about situations. Like when you are ready to gank, you ping the enemy player to "mark" as a target when you come out the forest. Or when there is a low HP hero running from you you can alert your team to intercept.
Putting down retreat pings really only works if you are a good player, good leadership skills and a team willing to communicate and play together. Since when only three retreat and the other two die that would not benefit very much. The easy cases is to retreat ping when there are 5 enemy heroes engaging and you just want your team defending at a tower instead of the open field. Or tell a noob that is far out in his lane without enemies showing on the minimap, but noobs would not be so noob if they listened to your pinging :D.