Option contracts are two sided contracts. There is an option buyer and there is an option seller (also called an option writer). The option writer collects the premium, but is then bound to fulfill the contract when exercised.
You can write put options (or call options for that matter) expecting that the option will expire out-of-the-money. Out-of-the-money options are not exercised, and the option writer is released from the contract at expiration. The option writer profits the premium collected when the option was opened.
The option open interest is used to determine at what strikes you write a put option. For example, consider AAPL stock on July 13th option expiration. The highest put open interest was at the 595 strike. The highest call open interest was at the 610 strike. Max pain theory states that hedge rebalancing activities by the option writers (usually the market maker) will cause the stock price to close with the highest open interest for puts and calls. So, max pain predicted the stock price would fall between 595 and 610. Based on that conclusion, selling a 590 put would have been below the 595 strike and therefore unlikely to get exercised.