From what I've heard it started with Imagination forest. When the children started bullying Mary, Shion quickly came out to help her but it was too late Mary had already passed away, Shion turned the boys into stone which caused her to die. Azami witnessing that found it far too cruel and tried to use the world she had created in Shinigami record (AKA the kagerou) which she had left because she had no use for it anymore. She could only bring back Mary with the order "bring cack those who were killed on August 15th" and she gave Mary the most basic but most important power a medusae has the ability to combine snakes.
This made Azami lose that ability herself and made her unable to take back the order to bring those people back. Which in due time caused the events in kagerou daze/kagerou days.
The abnormal circumstances ofcourse triggered scientists attention and they started to research. Kenjirou was in someway connected to those scientists. Ayano finds reports about takane and haruka and decides that if she can gain an ability others wouldn't have to be sacrificed. But it failed and she actually died. Which I personally think is the reason in Lost Time Memory that she tells Shintarou something along the lines of "I died, I'm sorry" because she didn't mean to die. She just wanted to know the truth behind it all.