If I'm a wizard on the material plane and I cast Summon Lesser Demons, then capture one of the demons with an Iron Flask, what happens to the captured demon when the spell ends one hour later? Does it disappear and return to its home plane, leaving the Flask empty, or is it bound by the Flask now?
It's unclear, and generally up to DM discretion
The creature can stay bound indefinitely
Summon Lesser Demons acts as any other spell: Once its duration ends, its effect effectively disappears. And Iron Flask dictates that, emphasis mine:
Once trapped, a creature remains in the flask until released.
This rules that the creature cannot be moved from the flask by any means, unless it's specifically released by the Flask's topper being removed. If we act under the assumption that this is a specific rule that affects one creature, thus overriding the general rule on summoning creatures, one can argue, using the PHB, that:
If a specific rule contradicts a general rule, the specific rule wins.
Thus, the rules on spell durations, as written, only apply to whenever the spell ends, there are no further rules in place to what happens if the creature cannot fulfill the condition at that point, but it isn't the only way the rules can be interpreted.
But it might not stay bound, despite being "in" the flask
Using a different, equally valid, interpretation of the rules, however, one could argue that the effect of a conjuration spell also specifically targets one creature, invalidating "Specific Beats General" as both are equally specific.
Additionally, the Flask does not specifically bind a creature, nor does it restrict traveling through planes explicitly, so it stands to reason that the creature is automatically returned to that plane, regardless of its current condition when the duration ends, as it's no longer under the effects of the original spell.
As there are no official rulings on this combination, it's down to the DM's judgement as to which interpretation to use.