There are several reasons to shift your line. If you have pass rushers, you want them to line up in the gaps to force the OL to move laterally. Run stuffers should line up on the OL. If you have a quick pass rushing DT going against a slow, lumbering, run blocking OG, you will have an advantage if you force the OG to move.
If you think the CPU is going to try to run outside, shift your line to the side you expect them to attack to give them a harder corner to get around. Shift the line in tight if you expect a run up the middle.
Shifting just before or as the ball is snapped will usually yield a player being unblocked because you can confuse the OL's blocking assignments. Typically, you always want to shift your DL when you are smaller than the OL.
There is a play in the 4-2-5 playbook (and I'm sure the concept is in the 4-3 book as well) where you have two LBs blitz the center area. Shift your DL wide and LBs in. Your four DLs will occupy the OTs and OGs. The LB you control (who is blitzing) attack and occupy the C. If your CPU-controlled LB is good, he will come free immediately (or get picked up by a back) and you get immediate pressure potentially resulting in a sack.