Imagine a person walking alone in the dark, and they wonder if someone is following them. They would probably look back "over their shoulder" to make sure that nobody is behind them.
The person is checking behind themself to make sure that nothing bad is about to happen; they want to know whether they are in danger or not.
There are many times in life where a person feels the same way, even if they are in a completely different situation. They will probably want to check whether they are in danger or not; whatever they do to check is often called "looking over their shoulder."
If I walk to the bus while I feel nervous or unsafe, I can say that I am "looking over my shoulder" even if I look to the sides, up, and down. The fact that I am checking to determine whether I am safe or not means that I am "looking over my shoulder."