The number one reason is that it's profitable. Adware and spyware can bring in quite a lot of money to companies that produce and install them on people's computers. Advertising is, and always has been, big business, and the companies that push the ads are well paid by the companies whose products they advertise to do it because marketing experts know that if they can keep shoving the name of a product in front of someone's face long enough, that person will have that product on their mind more. It might influence their purchasing decision to the product that they can't forget the name of because they see it every three seconds.
The other big thing is that personal information about people is valuable. Not just things like credit card numbers and bank account numbers which have direct-payoff value, or Social Security Numbers which get used for identity theft, but also information about your browsing and buying habits becomes valuable as a tool to those in marketing who want to be able to more effectively market to you. If they know the kind of sites you visit, the kind of products that you buy, and where you spend your money, they can try to entice you to their products and line their pockets. They find out how old you are and add this information in with information collected on thousands or millions of other people in your age group and then push products and services at that 'target demographic.'
It'd be nice if they'd stop doing it and we could go back to the days when the vast majority of the problems came from the tiniest minority of viruses, but it's more likely that as long as adware and spyware make money, and as long as there are places on earth were it's legal, it'll still be produced. What I'd like to see? Sanctions against companies that operate in and are based in countries where adware/spyware is illegal (and it should be) and who employ the makers of adware and spyware to collect information for them and shill their products. Tougher laws defining the rights of users to not have software installed on their computers without full knowledge and consent would also be a goal of mine.
You hire an adware company to shove ads for your product down people's modems? You pay. You hire a spyware company to surreptitiously collect information for your company? You pay.