Quite a bit ago, I stopped earning trading cards. Now, I use Steam a whole lot, so don't give me that,"You have to actually play the game" garbage. For example, I've played TF2 for over 1k hours, but as it turns out, I've never actually found a TF2 card, but it said I have no card drops any way. What do I do?
You can only get to drop half (rounded up) of the cards for a game. If a game has 7 or 8 cards you can only drop 4, if it has 9 or 10 then only 5, etc.
As for TF2, if you click "How do I earn card drops?" on your Team Fortress 2 Badge page, you would see the explanation:
How can I earn more drops?
You can receive additional card drops as a reward for spending money in game.
You have not purchased anything in game after this card set was released.
Progress to next card drop
(approximately $9.00 USD per card drop)
You are not currently eligible for a booster pack
Once you have received all of your card drops, you become eligible for a booster pack containing 3 additional cards. Booster packs are granted randomly to eligible users as more badges are crafted by members of the community. Make sure you log in to Steam each week to maintain eligibility.
Or on the Steam Trading card FAQ:
What about free to play games like Team Fortress 2 or Dota 2?
Free to play games drop game cards based on your in-game purchasing. For every $9 USD spent (approximate) since the start of the Steam Trading Card Beta, you will earn one card drop. This card will drop at some point as you play. If you have made in-game purchases in Dota 2 or Team Fortress 2 prior to the Steam Trading Card Beta, or if you owned Team Fortress 2 prior to the Free to Play update, you will have 4 or 5 additional card drops available.
You need to spend money in the TF2 in-game store to be eligible for the drops.
This isn't a glitch, it is by design.
The number of cards varies for each game but you can usually on earn 3 or 4 cards by playing, after that you have to either trade for them, buy them in the marketplace or be lucky enough to earn a random booster pack.
If you look at the 'badges' page under the tab with your profile name, your progress and how many cards you can still earn is displayed as well as further information about how to earn more cards. See screenshot from my FTL progress below.
You can see in the top right it says,"No card drops remaining" then "How do I earn card drops?"
I haven't started playing A Case of Distrust yet and the number of cards I can earn by playing is displayed in the top right instead.
ETA: I didn't realise that TF2 and other free-to-play games had a different system of earning card drops, please refer to gre_gor's answer for specific details of how to earn drops in those games.
The above information is still correct for the vast majority of games on Steam and you can always check for any specific requirements by clicking the "How do I earn card drops?" link on each badge.