An Option Writer (seller of Options) is chosen at random (or 'Assigned') by the operator of the Option Exchange where the Option is being sold.
In the case of American Style Options, this can happen at any time before expiry and is known as Early Assignment and an Option Contract owner can Exercise at whether the Strike Price is, irrespective of whether it is currently In The Money, Out Of The Money or At The Money.
When the Option Contract expires or if it is European Style option (which can only be exercised on expiry) if the Strike Price of the option is In The Money, the option is automatically exercised and assigned to an Option Writer.
External LinksOptions Assignment FAQ
An FAQ prepared by the Options Industry Council about Options Assignment.Exercise and Assignment, Early or Otherwise
A ThinkOrSwim article explaining Options Assignment and Exercise.Options Quick Facts - Expiration, Exercise and Assignment
CBOE article on Options Exercise and Assignment.What Is Early Exercise And Assignment?
Options Playbook article describing Assignment and Early Exercise.Can Options Assignment Cause Margin Call?
Guest post on the SteadOptions.com site by Christopher B. Welsh where he describes how the assignment of short (sold) call options can result in receiving a margin call from your broker.Trading Traps for the Unwary II
Mark D. Wolfinger describes some hazards of holding stock options (including ETFs) during ex-dividend periods and expiration.