What was its actual end game? It just seemed like they made a made a massively stupid mistake of attacking the US. I can't get my head around what they could have possibly hoped to achieve.
You might be interested in some threads from FAQ on both the goals of the Pearl Harbor attack in specific and the larger goals that the Japanese high command hoped to achieve in the aftermath of a successful war: