Buying goods

What are your rights when you buy goods – new and second-hand? How do guarantees and warranties work? Are your rights the same when you shop in the sales? What happens if you change your mind after you buy something?