Do it once a year, like changing your smoke alarm batteries. Or do it right after a flood, heavy rain, or if your water test shows bacteria. Also, do it after a power outage that shut down your pump for a while.
If your water smells like a swamp, or your kids start skipping their baths, it’s time. Trust your nose. It’s smarter than you think.
A quick word of caution (don’t skip this part)
Never use scented bleach, or laundry pods, or anything fancy. Plain, unscented liquid bleach is the only thing that works. Scented stuff leaves a perfume layer in your well. Nobody wants lavender-scented shower water.
How To Safely Shock A Drilled Well For Clean Water | ShunTool
Also, if you have a septic tank, be careful not to pour the bleach directly into it. The bleach in your pipes will be diluted enough, but don’t flush the bucket down the toilet. That’s just mean to the septic tank bacteria.