Carrot and stick (also "carrot or stick") is an idiom that refers to a policy of offering a combination of rewards and punishment to induce behavior. It is named in reference to a cart driver dangling a carrot in front of a mule and holding a stick behind it. The donkey would move towards the carrot because it wants the reward of food, while also moving away from the stick behind it, since it does not want the punishment of pain, thus drawing the cart.
Some claim that this usage of phrase is erroneous, and that in fact comes from the figure of a carrot on a stick. In this case, the driver would tie a carrot on a string to a long stick and dangle it in front of the donkey, just out of its reach. As the donkey moved forward to get the carrot, it pulled the cart and the driver so that the carrot would always remain out of reach.