It depends on the state you are registered to vote.
There's an article I came across about this, you can read the whole article since it includes examples too.
The answer depends mostly on where the voter is registered, because American election laws and procedures are for the most part determined by the individual states, even in elections for federal office. In New York, for example, an absentee ballot can be challenged on the grounds that the voter died before Election Day (in-person early voting is not available in New York). Minnesota, which has both early voting and absentee voting, allows for a challenge in both cases if proof is presented to an election judge that a voter died before 7 AM on Election Day.
But most states do count the votes of the recently deceased, according to the bi-partisan National Conference of State Legislatures (NCSL), an NGO that tracks US state election laws. In the case of Florida, state law spells it out clearly: "The ballot of an elector who casts an absentee ballot shall be counted even if the elector dies on or before Election Day."
(emphasis mine)
Basically for those states that counts it, it's because your vote is cast the moment you cast your vote. So, regardless of what happens, the vote is still cast and decided by you.