When to shock is easy: never. Keep the chlorine high enough consistently and you never get algae.
Most of us raise the FC before and after a big swim party, but nothing like the overdone megadose the pool store recommends as a "shock."
With the exception of chlorine gas (which only gigantic commercial pools can justify) all forms of chlorine leave something behind. They all have a carrier of some type. Trichlor and dichlor leave behind cyanuric acid - CYA - while Cal-hypo leaves Calcium. Bleach/pool chlorine/liquid shock/whatever they call it is sodium hypochlorite and only leaves behind salt.
All this chemistry talk will make sense once you get some hands-on experience testing and dosing and seeing the results.