When do I use "it's" with an apostrophe?
Only when you mean "it is" or "it has." Everywhere else, the possessive its has no apostrophe.
Contexti
The apostrophe in it's stands in for a missing letter — the i of is or the ha of has. That's the same logic as don't (do not) or she'll (she will). Once you read the apostrophe as a "something is missing here" sign, the rule becomes obvious.
A little moreii
It's raining unpacks to it is raining. It's been a while unpacks to it has been a while. If the unpacking breaks the sentence ("the dog wagged it is tail"), you want the possessive its.
Examplesiii
I think its going to rain.
I think it's going to rain.
*It is going to rain* — contraction → *it's*.
Its time to leave.
It's time to leave.
*It is time to leave* — contraction → *it's*.
Watch foriv
None. If you can replace the word with it is or it has, the apostrophe is correct. If you cannot, the apostrophe is wrong.
The full entryv
Possessive versus contraction — a rare case where no apostrophe wins.