The poor little punctuation mark is so misused that sometimes I think he should be put out to pasture.
It's easy, folks.
Rule 1. When the word is a contraction ("do not"==>"don't" "it is"==>"it's") you replace the letters that aren't pronounced with the apostrophe.
Rule 2. When there's a possessive "s" added to a noun, the apostrophe goes before the "s" when the noun is singular ("John's hat," "the cat's meow).
Rule 3. When there's a pluralizing "s" added to a noun that is also possessive, the apostrophe goes after the "s" ("the horses' tails," "the Smiths' dinner party").
Three simple rules, folks, that's all.
"It's" and "its" sometimes cause trouble, but they follow the rule.
"It's," meaning "it is" takes the apostrophe internally, because it's a contraction.
"Its" as a possessive doesn't take an apostrophe any more than "his" does--pronouns don't take a possessive apostrophe.
So: "It's a boy!" meaning "It is a boy!" but "Its eggs are green" because "its" is neither a contraction nor a possessive noun.
So endeth the rant. Amen.
(For extra credit: "apostrophe" is also one of the many devices of classical rhetoric:
A digression in the form of an address to someone not present, or to a personified object or idea, as “O Death, where is thy sting?”Go and sin no more.