Because each state has the authority to operate its elections as it chooses, duh. Not a tough question...
Really there isn't that much variance. 6pm to 9pm. Kentucky and Indiana are ridiculous and should change to 7 or 7:30 at the least
The farm legacy reflecting that those states were once very rural when the times were set. Public officials wanted the vote done early so that they could count the votes early enough that they would not have to stay up late to count the votes. Get home before the deer or the drunks were out, perhaps?