Comps (or comparative titles) are one of those things that seem to give some query-writers fits. Is this an appropriate comp or not? What if I can't think of any titles similar to my story? So let's hash some of those things out.
First, unless an agent specifically requests, you don't need comps. That isn't to say that you shouldn't put some consideration into what might apply, but you don't need to pull your hair out about it, either. I've been compiling a spreadsheet of possible agents to query for myself (that's a subject for another thread), but in it I've only found one or two agents who specifically request comps. Most others seem to be leaving it to the writer's discretion.
So, what should you be thinking about with comps? One thing is that it needs to be recent. I adore the book Watership Down, but it was published in 1972. Therefore, if I wrote that genre, it wouldn't be a good comp, no matter how much it otherwise fit my book, because it doesn't mean anything on the current trends of readership and what the public buys. What people want to read and pay for changes, and it changes quickly. I've heard a few numbers thrown out there: comps must have been published in the past 2-3 years, or no more than 5 years. Either way, you're looking at recent and relevant.
You're also safest sticking with books for your comps, rather than movies/TV shows/graphic novels/etc. And that's because what's popular in one medium might not translate to another. Superhero movies are big right now; superhero books, not so much. From my own personal standpoint, many of my favorite TV shows are urban fantasy, but I don't read that genre nearly as much, so a book being compared to Buffy the Vampire Slayer or Supernatural is going to mean only so much to me. There can be successes using other media, but your best bet is to use other books for comps.
There's another important point as well: don't pick something that is extremely popular, particularly if it has been adapted to screen. We'd all love to have our stories be adapted in a four-movie deal with Lionsgate or get eight seasons on HBO. But if you pick the Hunger Games as a comp for your YA dystopia or Game of Thrones for your epic fantasy, it can come across as you having unrealistic expectations (and therefore perhaps not being the easiest to work with), and implies that you maybe don't have a very deep understanding of the genre you've written. Maybe, the agent might think, you watched Game of Thrones and thought, Hey, I can do that, without ever touching a fantasy book. And that doesn't bode well for your story. You need to show you've more than scratched the surface of your genre. And if you really haven't read more books in your genre... Stop querying, and go read some more. Then go back to your manuscript, make sure it's actually a fresh telling of that genre, and then go back to query. If you want to write, you have to read your genre.
I won't claim to be an expert on all things comps, of course. But I'm not coming up with all of this on my own. Some agents write blogs, where they'll give tips about writing queries, including info about comps: http://bookendsliterary.com/2019/01/15/the-weight-of-comp-titles/; http://bookendsliterary.com/2018/08/07/using-comp-titles-in-a-query-letter/ . Some agents might mention on their Twitter what their preference for comps is. I've started this thread so that people can ask questions, or share resources. Feel free to plunk down more blogs like the ones I've shared above. If you have an idea of where people can look for books that might work for them, throw them in. I've heard some people mention Goodreads on that front. I've personally perused the genre pages in tvtropes.org to see if anything popped out (it didn't, but that doesn't mean it might not work for someone else). And, hey, if you've got some bone to pick with what I've said, say it. That's why we're a community here, because all of our brains are better than just one.
Hope this is a helpful starting point for people. Happy writing to all.