Why does the Infinite Tsukuyomi work only on the living? (As the Edo Tensei Hokages were not affected by it)
The reason why the Infinite Tsukuyomi works only on the living is, chakra. The goal of the Infinite Tsukuyomi is to extract chakra/life-force from the host and feed it to the Shinju. By doing this, the Shinju drains the victims' chakra pool and in the end, the victims become White Zetsu. The White Zetsu are then under the control of Kaguya, making them the ideal mindless slaves.
Since non living things do not have chakra, they obviously are of no use to the Shinju or Kaguya. Since the Edo Tensei shinobi are already dead, the "life force" requirement of the Infinite Tsukuyomi isn't not fulfilled.
Along with non living things, the following are also immune to the Infinite Tsukuyomi:
- Shinobi reincarnated via Summoning: Impure World Reincarnation are not affected by this technique.
- Black Zetsu is unaffected by the technique, as is anyone he is attached to at the time — namely Obito Uchiha.
- Those who lack a brain or sensory organs, like White Zetsu.