34 states offer early voting. Voting rules and regulations vary by state. However, all states count all the ballots that are handed in weather it be at the poll, mail in, or early voting. So yes your ballot is counted even if you die after handing it in, Same as if a soldier is killed in combat after submitting an absentee ballot. There is really no way for the states to know if you died after submitting a ballot or any way for them to know a particular ballot is yours remember voting is anonymous.