If a hand is tabled, the cards speak. If you misdeclare your hand, but show your cards, your cards will overrule anything you said.
Verbal "
actions" in turn are binding. Actions are things like: check, bet, fold, call, and raise. Think about things which have a button you can click on when playing online. There's no button to tell the other player what your hand is.
There's some debate about whether or not folding is a valid action if you're not facing a bet. For example, if someone checks, then you may or may not be able to fold. Without action, you may be forced to at least check. If someone bets and you call at the river, you're past the point of being able to fold. You have already acted, by calling. You can choose to muck your hand, and throw it away without showing, but you can't fold.
From Robert's Rules of Poker (which are normally the standard for most rooms, unless house rules state otherwise)
THE SHOWDOWN
2. Cards speak (cards read for themselves). The dealer assists in reading hands, but players are responsible for holding onto their cards until the winner is declared. Although verbal declarations as to the contents of a hand are not binding, deliberately miscalling a hand with the intent of causing another player to discard a winning hand is unethical and may result in forfeiture of the pot. (For more information on miscalling a hand see “Section 11 - Lowball,” Rule 15 and Rule 16.)