Depends on voting laws where the voter lives.  In some states a "write in" candidate must register as a "write in candidate" in order for the vote to count.  Other states have no such requirement, and the vote counts.