Why did Persian war take place?

The immediate cause was that Athens and some other cities gave aide to Greek cities in Ionia which were rebelling against their Persian overlords. The ultimate cause was that the Persian Empire was constantly expanding and eventually it would have found itself in conflict with the emerging power of the Greek maritime states eventually anyway, and would have found a pretext to try to bring the Greeks under Persian control.