Origins of periodic and chaotic dynamics in microfluidic loop devices