US forces are set to pull out from their last bases in Iraq, leaving the country where 4,500 of their comrades died over more than 20 years of war.