C-betting for value is more straightforward than bluffing. In general, every time that you make a good hand – for example, top pair or better – you should go ahead and c-bet. The main reason for this is that when you have a strong hand it's crucial to build the pot up as much as you can so you can obtain the maximum value. There is an argument for checking instead, and allowing your opponent to bluff, but the dangers of your opponent checking behind means it is rarely going to be the best option unless there are exceptional circumstances – such as your opponent being a complete maniac!
Knowing whether to c-bet or not when you have a medium strength hand is more complicated. Let's say you raise pre-flop with T-8, one player calls on the button and the flop is Q-8-2. You have middle pair with a weak kicker and a decision to make. When you bet in this spot, it's going to be tough to get called by worse hands. Unless your opponent is very optimistic he will probably fold hands like Ace-high, a worse Eight or small pocket pairs to a bet - meaning that when you get action you will probably be up against a hand that beats you. In this case, c-betting will usually be a mistake. Instead, you should check your mid-strength hand and hope that it either a) gets checked behind (in this case you are probably ahead) or b) that you induce your opponent to bluff. Your hand is good enough to call a bet if that's the case and you can then re-evaluate what to do on the turn and river if you face more action.
When you miss the flop completely, you should look to continuation bet regardless most of the time. Online poker pros advise that you c-bet approximately 65-70% of flops and the reason for this is that these bluffs have a high success rate. By raising pre-flop you are representing that you have a hand with high cards in it – Aces, Kings and Queens mainly – so flops that involve one of those cards are perfect to bluff. On the other hand, there are types of flops that you generally should avoid c-bet bluffing on. These are either very coordinated flops, such as 9-8-7 rainbow or K-9-7 all of the same suit, or flops which you suspect have hit your opponent hard. In a lot of cases there will be crossover between the two. Always think about what your opponent could have when they call a raise pre-flop. A common hand to have in that situation is something like suited connectors or middling hands such as A-J, Q-J or J-T. So, when the flop involves one or more of these cards it's probably best not to bluff!
One final thing to consider is how much to bet when you are making a c-bet.
Between 60-75% of the pot size is a good number that strikes the balance between getting value for a strong hand and keeping your bluffs as cheap as possible (in case they don't work!). It's also important to note that whatever bet size you do choose, try to keep it the same no matter the strength of your hand. If you bet huge with strong hands and small with bluffs – or vice-versa – then perceptive opponents will quickly pick up on this, leaving you in a lot of trouble. Keep the sizing the same and you keep them in the dark.