One good rule to remember when you are choosing a bet size is that when betting for value you should bet the largest amount that you think your opponent will call. This can be situation-specific too, so make sure you are paying attention. For example, let's say you are playing a poker tournament with 50/100 blinds. A player raises to 300 and you have pocket Aces on the button. Against a good player you should re-raise to around 900 – anything more and he would have to hold a huge hand like K-K or Q-Q to continue. This is bad for you as you want to get maximum value for your Aces. This principle does not apply however when you are up against a weaker player who doesn't like to fold. When this is the case raising to 900 would be a mistake – remember that you should bet the largest amount you think your opponent will call. A re-raise to around 1500 would be better because you are still likely to get action and are getting more chips into the middle with the best poker hand you could be dealt.
When playing post-flop the same principles apply but there are some more general strategies you can follow too. Betting between 65-75% of the pot on either the flop, turn or river is a good play that strikes the balance between getting value from opponents with worse hands and not betting so big as to scare them off. If you were instead to bet only 20-30% of the pot you would be giving opponents with flush or straight draws too cheap a price to get lucky and beat you. Whereas if you were to bet the full pot you would be unlikely to get calls from the very hands you want to call you!
While those general rules are important to follow there are exceptions that you should be aware of too. If a flop is very draw-heavy then a larger bet makes sense, to charge players the maximum if they have a draw. Let's say you have A-K on a Ks-Js-8c flop in a $1/$2 cash game with $30 in the pot. You are first to act. On a less scary flop your standard continuation bet might be $20 (about 66% of the pot). However, in this situation it makes sense to bet larger, around $26, just because there are so many combinations of hands your opponent could have that might overtake you on the turn. Bet bigger now and force them to pay more to get lucky!
Alternatively, there will be some situations where you know you have the best hand but also that your opponent doesn't really have anything they can call a big bet with. When this spot occurs, you may wish to bet much smaller than usual. Even if it is just a single big blind that you can acquire from a bet and a call, it's better than nothing and will add up over time.
There are general rules to fall back on when sizing your bets but the most important advice is to study the table and be willing to mix it up accordingly. If you don't do this you might be missing out on some easy value.