Complex sentence: People offer yams to gods and ancestors before distributing them to the villagers to supposedly give thanks to the spirits above them.
Split into simpler sentences: People offer yams to gods and ancestors first before distributing them to the villagers. This is their way of giving thanks to the spirits above them.