What to KnowIt's is a contraction and should be used where a sentence would normally read "it is" or "it has." The apostrophe indicates that part of a word has been removed. Its with no apostrophe, on the other hand, is the possessive word, like "his" and "her," for nouns without gender. For example, "The sun was so bright, its rays blinded me."
It's happened to all of us: you type it's and later realize you meant its. (And by "realize" we occasionally mean, "got flamed in the comments section.")
The rule is actually pretty simple: use the apostrophe after it only when part of a word has been removed: it's raining means it is raining; it's been warm means it has been warm. It's is a contraction, in the style of can't for cannot and she's for she is.
But this rule wouldn't have worked a few centuries ago.
History of It's vs. Its
Long ago, English was like many other languages in that every noun had a gender: masculine, feminine, or neuter. Pronouns—those efficient little words we use to stand in for nouns, like I, you, he, she, we, they, and it—also had gender; the gender of a pronoun was determined by the gender of the noun it referred to. The possessive pronoun for neuter nouns was his: "April with his sweet showers." But when English began to link his and her only to actual males and females, his for objects seemed increasingly wrong, and it—with no s—began to be used: "April with it sweet showers." Around 1600 it's began to be used: "April with it's sweet showers." The it's had an apostrophe, just like a possessive noun like April's would.
This apostrophe form of the possessive remained extremely common throughout the 17th century. The version without the apostrophe only became dominant in the 18th century, probably because it's was taking on a new role: replacing the contraction 'tis. It's here had arrived and 'tis here was fading away.
We still see the possessive it's in dashed-off emails and advertisements, but the fact that it was right 300 years ago doesn't make it correct today. For those of us who live—and write—in the here and now, use it's only when you mean it is or it has. And drop that apostrophe everywhere else.