the answer to the origin of this strategy is unclear.  There are 3 different theories of its history:
1.Marketers (such as RH Macy) of mid 1800s tried to ambush their competitors in highly price sensitive goods.
2.Melville Stone of Chicago Daily News priced his paper at 1 cent. However, given that cents were not in common use then, he coaxed local shops into odd pricing so that his customers will have the pennies to spend on his paper.
3.As Quora User suggested, it was a cash control mechanism due to the arrival of the cash register.
Why do they continue to do odd pricing?
Customers see odd numbers as correctly priced rather than whole numbers. They tend to think that a rational process is involved in the pricing and go with the pricing. On the other hand, with whole pricing, some customers perceive that they are being gouged.
Odd pricing also sends a psychological cue that the good is priced to the lowest possible.
In the earlier days, competitors in commodity products tried to gain more market share by pricing a penny or two lower than their competitors.
Various researches indicate that customers are swayed more by the most significant first digits of a price tag and sometimes by the last digit. In one research done in 1997 they found that 90% of the prices end with either 9 or 5. However, as customers are subconsciously getting used to these odd prices, other companies like Wal-mart favor more of pricing ending with .98 to stay out of the crowd.