That was a confusing part.
Like back in the other season when Hannah saw her in the hospital. I didn't know if that was real or not either
I don't think anyone really knows for sure. I think the writers of the show want to keep people guessing whether it was imagined by Emily or not. BUT she did say "Two can only keep a secret if one of them is dead" so does that mean she's alive?! I think it would be awesome if she was alive.
I think the thing that confused me was the whole shovel thing. If the police knew that that shovel was used to murder Ali, then why was it at the barn? Wouldn't important evidence like that be kept in a safe place? I don't know.
Also, that whole doll thing was creepy.