The explanation I've heard is that blood vessels in the brain spasm, which causes them to release some substance which then causes neighboring ones to do the same, so there's an expanding wave of twitching blood vessels, I guess. Sort of like a temporary stroke, I guess.
But I saw someone somewhere mention a new theory, that it may be more like epilepsy, but I haven't gotten around to looking that up yet.
This reminds me of that woman who was a brain researcher and had a massive stroke -- when she realized it was stroke she said she thought (for a moment), "wow, this is so cool..."