In reality you need a University degree to answer this question. But forget that and look at the bascs.
We could have a player from an opposing team hanging around the goal mouth and even obstructing the view of play by the goalie. But basically speaking: If an opposing player is standing anywhere in the field and there is not a home player between him and the goal, he is deemed to be off-side, simple as that really. The only time it does not occur is if the opposing team player takes possession of the ball and plays it through, he cannot be offside, but if he passes the ball to a player in the offside postion, it is an off-side offence.
The search for people who can answer your question continues for as long as needed - until you find the answer you were looking for.
When an answer is posted by someone who was invited (byYedda or by yourself) to answer your question, their answer is marked with a yellow "invited by Yedda".
To be invited to answer other people's questions in your areas of knowledge and interest, be sure to list your favorite topics:
» My Settings My Topics.
Of course, the more helpful your answers are, the more likely you are to be invited to future questions...