The problem is obviously in the last step.
When you rasing some number by a complex you should use the following definition:
So in your case we have , raising to the power i we get:
Now remember the definitino of Log in complex plane:
, and this function is multivalued so you need to pick a branch cut for the argument.
In your case obviosuly the equality is wrong cause one side of the equality you pick n=0 and on the other you picked another different number, you can't do this.
Edit: Does some know why the tex doesn't get compiled?