c. 1300, partie, "a part, division, section, portion," a sense now obsolete; also "physical piece, fragment; section of a book or treatise," from Old French partie "side, part; portion, share; separation, division" (12c.), literally "that which is divided," noun use of fem. past participle of partir "to divide, separate" (10c.), from Latin partire/partiri "to share, part, distribute, divide," from pars "a part, piece, a share" (from PIE root *pere- (2) "to grant, allot").
In early use the word often appears where we would have its relative part (n.). Also from c. 1300 in the legal sense "person or group of persons involved in a lawsuit, agreement, etc.," and in the political sense of "a number of persons united in supporting a person, policy, or cause." From early 14c. as any "group of people," also "a social class." Meaning "a person, a paritcular person" is from mid-15c.
The military sense of "a detached part of a larger body or company" is by 1640s. The sense of "a gathering for social pleasure" is found by 1716, from general sense of persons gathered (originally for some specific, temporary purpose, such as dinner party, hunting party).
Phrase the party is over "enjoyment or pleasant times have come to an end" is from 1937; party line is recorded by 1834 in the sense of "policy adopted by a political party," and by 1893 in the sense of "telephone line shared by two or more subscribers." Party pooper "one who casts gloom over a convivial event" is from 1951, American English.