1838, from neck (n.) + tie (n.). American English slang necktie party "a lynching" is recorded from 1871.
The noose used in a hanging: They'll put a necktie on you (1871+)