Steam Trading Cards were released as a Beta on the May 15, 2013. Beta ended on June 26, 2013, at which point it became available to all Steam users.
Not all games on Steam have trading cards: its up to the game's developers to decide if they want to participate or not. If a game does participate, it will have 5-15 cards in the set. These cards appear in 2 forms, standard and foil, which is rarer. When you collect all of the cards, you can craft them into a badge.
Each game has 6 types of badges: 5 levels of the standard badge, and the foil badge. When you craft a game's badge the first time, you'll receive the level 1 version of the badge. Crafting it again will upgrade the badge to level 2, and so on, up til level 5. Once you reach level 5, you cannot craft that game's cards into a badge again. The foil badge for a game can only be crafted once.
As you craft badges, you'll receive experience. Each level of a badge is worth 100 points of experience (so a level 5 badge is worth 500 experience.) Gaining experience will cause you to gain levels.
How do I get cards?Edit
The primary way to get cards is to purchase a game and play it. By doing so, you'll receive 1/2 of the cards in that game's set (rounded up.) These cards can be duplicates. To get the rest of the cards for a set, you'll either need to trade with your friends, purchase them from the Steam Community Market, or wait and hope you receive a pack.
Free-to-play games work differently. Because you can't actually 'buy' the game, card drops are based off of how much you spend on in-game content for that game. The current rate is that for approximately every $9/9€ spent, you'll receive 1 card drop. This may vary from game-to-game, though.