New York’s highest court has upheld a law shifting local elections to even-numbered years, bringing most county and town elections in line with statewide and federal races.