ยง  16-106.  Proceedings  as to the casting and canvass of ballots.  1.
  The  post-election  refusal  to  cast:  (a)  challenged  ballots,  blank
  ballots,  or  void  ballots; (b) absentee, military, special, or federal
  write-in ballots; (c)  emergency  ballots;  and  (d)  ballots  voted  in
  affidavit  envelopes  may be contested in a proceeding instituted in the
  supreme or county court, by any candidate or the chairman of  any  party
  committee,  and  by  any  voter with respect to the refusal to cast such
  voter's ballot, against the board of canvassers of the returns from such
  district, if any, and otherwise  against  the  board  of  inspectors  of
  election  of  such district. If the court determines that the person who
  cast such ballot was entitled to vote at such election, it  shall  order
  such  ballot to be cast and canvassed, including if the court finds that
  ministerial error by the board of elections  or  any  of  its  employees
  caused such ballot envelope not to be valid on its face.
2.  The  canvass  of  returns  by  the state, or county, city, town or
  village board of canvassers may be contested, in a proceeding instituted
  in the supreme court by any voter, except a proceeding on account of the
  failure of the state board of canvassers to act upon new  returns  of  a
  board  of canvassers of any county made pursuant to the order of a court
  or justice, which may be instituted only by a candidate aggrieved  or  a
  voter in the county.
3.  The  attorney general, on behalf of the state, and the chairman of
  the state committee of a party, may  institute  any  proceeding  allowed
  herein relating to the returns of canvass by inspectors upon the vote of
  any ballot proposal submitted to the people of the state.
4.  The  court  shall ensure the strict and uniform application of the
  election law and shall  not  permit  or  require  the  altering  of  the
  schedule or procedures in section 9-209 of this chapter but may direct a
  recanvass  or the correction of an error, or the performance of any duty
  imposed by this chapter on such a state, county, city, town  or  village
  board of inspectors, or canvassers.
5.  In  the  event  procedural  irregularities  or other facts arising
  during the  election  suggest  a  change  or  altering  of  the  canvass
  schedule,  as  provided  for  in  section  9-209 of this chapter, may be
  warranted, a candidate may seek an order for  temporary  or  preliminary
  injunctive relief or an impound order halting or altering the canvassing
  schedule  of  absentee, military, special or affidavit ballots. Upon any
  such application, the board or boards of elections have a  right  to  be
  heard.  To  obtain such relief, the petitioner must meet the criteria in
  article sixty-three of the civil practice law  and  rules  and  show  by
  clear   and   convincing   evidence,   that,   because   of   procedural
  irregularities  or  other  facts  arising  during  the   election,   the
  petitioner  will  be  irreparably  harmed  absent  such  relief. For the
  purposes of this section, allegations that opinion polls  show  that  an
  election  is  close  is  insufficient  to  show  irreparable  harm  to a
  petitioner by clear and convincing evidence.
6. A proceeding under subdivisions one and three of this section  must
  be  instituted  within  twenty  days  and  under subdivision two, within
  thirty days  after  the  election  or  alleged  erroneous  statement  or
  determination  was  made, or the time when the board shall have acted in
  the particulars as to which it is claimed to have failed to perform  its
  duty,  except  that such a proceeding with respect to a village election
  must be instituted within  ten  days  after  such  election,  statement,
  determination or action.
Structure New York Laws
Article 16 - Judicial Proceedings
16-100 - Jurisdiction; Supreme Court, County Court.
16-102 - Proceedings as to Designations and Nominations, Primary Elections, Etc.
16-104 - Proceedings as to Form of Ballot, Party Name, Etc.
16-106 - Proceedings as to the Casting and Canvass of Ballots.
16-108 - Proceedings as to Registration and Voting.
16-110 - Proceedings as to Enrollment.
16-112 - Proceedings for Examination or Preservation of Ballots.
16-113 - Proceeding With Respect to Voter Verifiable Records.
16-115 - Proceedings With Respect to Utilizing Certain Buildings as Polling Places.
16-116 - Proceedings; Provisions in Relation Thereto.
16-118 - Proceedings to Review Removal of Committee Member or Officer.