This may be over simplification......Think about making veggie soup in a pot at home, all of the heavy stuff (potatoes and carrots)goes to the bottom, the cooked onions(light stuff) float to the top. When the puddle is molten, the heavy stuff(metal) goes to the bottom, the slag(lighter stuff) floats out on top. But...this doesn't explain out of position welds....