I think the theatrics with Karifean made it all possible. Before he claimed cop, things looked to be turning against both of us slightly. So when he decided to claim cop and out me as Mafia, I had an opportunity to get onto your good side. By killing off the fake cop who proved to be Mafia, that should have put me quite low on the suspect list. After he accused me, either people would believe him and I would die (in which case Eiko looks like the fake cop), or people wouldn't and he would die (in which case I look super innocent).
It seemed obvious that one of us was likely to die anyway, so we tried to make the most of it.
Your other mistake was just luck of the draw; you had already said you were suspicious of Steiner. I figured you were likely to investigate either him because of those suspicions, or me because you'd tried to investigate me before but been blocked. If you chose me it was game over, as you were basically confirmed the true cop, or if you'd investigated Vivi, killing Steiner would have been in vain. But I got lucky!