A goal kick is awarded if the ball crosses the goal line but a valid goal is not scored, and the ball was last touched by the attacking team.
When the ball goes over the end line, and the attacking team was the last one to touch it, the defending team is awarded a goal kick.
The offensive team gets a free kick
A goal is awarded to the opposing team and the restart is a kick off.
If the penalty was successful, then no goal is awarded and the kick is retaken. If the penalty was not successful, then no goal is awarded and an indirect free kick is awarded to the defense. They will not get a 2nd shot at the goal because their own player infringed.
If the ball crosses wholely over the goal line (but not inside the goal) and was last touched by the attacking team, the defensive team is awarded a goal kick.
If the ball crosses the goal line and was last touched by a defensive player then there are two possible restarts. 1. If it crossed between the goal posts and under the cross bar, then a goal is awarded and the restart is a kick-off for the defense. 2. If it crossed outside the goal posts or over the cross bar, then the restart is a corner kick for the attackers.
A direct free kick is awarded when someone commits a penal foul: handling the ball, tripping or attempting to trip, striking or attempting to strike, kicking or attempting to kick, jumping at, charging, or pushing an opponent. The ball is placed at the spot of the foul, and a player on the offended team takes the kick. The ball is in play when it is kicked and moves. If a direct free kick is awarded within the kicking team's own goal area, the ball may be placed anywhere in the goal area for the kick (similar to positioning for a goal kick). If a direct free kick is awarded within the kicking team's own penalty area (including the goal area), the ball is not in play until it is kicked directly out of the area. If the direct free kick is awarded in the offending team's penalty area, a penalty kick is awarded instead.
A goal kick is awarded to the defending team whenever the ball completely exits the field across the goal line, not between the goal posts and under the cross bar, and was last touched by an attacking player.
A goal kick is awarded when the ball completely exits the field across the goal line and was last touched by an attacker.If it does so between the goal posts, under the crossbar, and was not directly from an indirect free kick or a throw-in, then a goal is awarded and the restart is a kick off for the defense.
clearance
An own-goal may not be scored directly from a restart. (Well, maybe a drop ball, but technically it's no longer a restart once it hits the ground.) The goal would not be awarded and the restart would be a corner kick for the opposing team.
If the kick from a kick-off goes directly between the opposing team's goal posts under the crossbar, then a goal is scored. If the same happens against the kicker's own goal, then a corner kick is awarded instead of a goal.