The blue lines mark off the offensive zones.
The puck must enter the offensive zone (i.e. cross the blue line) before any offensive player fully crosses into the offensive zone with both skates. Violation is an offsides which stops the game and sets for a puck drop just outside the offensive zone.
Any time the puck leaves the offensive zone the entire offense must leave the offensive zone before the puck can re-enter the offensive zone and be played by the offense. Otherwise it is an offsides penalty.
This will help you understand why teams play the way they do in offensive setups and why defenses are happy to just get the puck outside the offensive zone.
A goal can be challenged if there was offsides on the play, regardless of how long the play in the offensive zone continues after the offsides.