It's simple. Shoot, Shoot, Shoot, and score more goals than the other team.
Offsides. The puck crosses the blue line before an attacking player.
Icing. Flinging it from behind the red line at center ice all the way down without anyone playing it.
Penalties, hooking, tripping, holding, high sticking, etc.