A collar strategy is only in part to protect your gains made on the underlying stock. The collar strategy consists of buying protective puts and at the same time writing covered calls.
You are right in saying "If you want to protect your gains, why would you not simply buy an OTM put?". This is known as the Protective Put and if you simply want to protect your gains, this is the way to do it.
When you also write a covered call, you once again got it right that it is usually used to offset the premium costs of the put.
However when you combine the two strategies (creating an equity collar), your view of the market would be that it is moving sideways. I.E. you are expecting the asset prices to not rise above your written call's strike price, and you are protecting your asset prices in case it falls below your put's strike price. And in the meantime, you are still holding on to the asset earning dividends while the covered call is financing the protective put.
On a side note, this question seems to be more in tune with the Quantitative Finance Stack Exchange community.