Trivago is in the hotel business, which has better margins. Some sites like Expedia will actually take a loss on a flight if you book it with a hotel or rental car, which they make a profit on.
Kayak (and the rest of the Priceline/Booking.com group) takes a much more advertising driven model. You'll notice the site has lots of pushes to sign you up for their various mailing lists that yield long term reoccurring revenue on airline credit cards and travel packages.