Other search engines will show you ads to make money. Search engines will target you with ads in two ways.
The first is based on your query. Advertisers can target ads based on keywords which are similar to that search query.
Second, search engines use a variety of technologies to track your behavior and build a profile of you as a user, which can then be used to target you with ads.