BAGHDAD — U.S. military forces are set to depart from bases in Iraq on Wednesday following two decades of American involvement that resulted in the deaths of hundreds of thousands of Iraqi civilians and thousands of U.S. troops, and now leaves a battered but increasingly influential Iran at the center of the region’s future.