Folding is surrendering a hand: you release your cards and stop playing the hand. You don't owe any money--but you can no longer win the pot.
Two notes on when not to fold:
The act of folding is easy: simply state "fold" or "I fold," and then put your cards face down and slide them away from you. You can usually slide them towards the dealer, who will collect discarded cards.
Keep in mind: once you fold, you're out--no dredging up old cards! Even if your opponent later shows you that they had the worst hand, you're still out.
Mucking is not quite folding, even though it seems very similar. You fold to a bet (you've decided not to call a bet) but mucking is when you discard your cards during a showdown (when you have called, and the other player or players show their cards). This is simply admitting that your opponent has the better hand and you don't want to show yours (maybe you were chasing a draw, or maybe you were bluffing, or maybe you just want to keep your information secret). But keep in mind: sometimes you have to show your cards, and can be penalized for mucking. This includes (1) if you were last to bet on the last round of betting, in which case you're obligated to show your cards first, and (2) if everyone checks the last round of betting and you're first to act.
One way mucking is like folding: if you do it, you're out of the running--no takebacks, even if you made a mistake or realize your opponent showed a weaker hand.