How to manage literature when writing a dissertation/paper
Throughout working on the paper (including thinking before I start to write and then writing), whenever I find a paper that may be relevant, I save it. I make sure not to save anything that I see but only after checking the abstract and when I decide that there is a good chance that I will want to mention it in the literatere review part of the paper. I use Mendeley for this, but I can imagine google drive or even just a folder with PDFs would work.
I also do some searching on Google Scholar before I start working on the problem (to make sure that it is not already known) and then before I start writing (I have a better picture of the problem and my result by then; I also catch new papers this way). I also throw all the papers into Mendeley. Again, not anything that I find, only those I decide I will probably want to cite.
When the time comes, I go through all the papers, decide which ones to include, and write the &quot;related work&quot; part of the paper. Because I have filtered out the not so relevant papers before, I only usually have about 30 papers. Those I decide not to include, I usually move to some other folder to make the writing easier.

The nice thing about Mendeley and similar software is that it allows you to save notes, this can be useful if you read through a paper, decide it is relevant but it is not obvious at first glance how. By making a note, you don't have to think about how it is related when you are writing the literature review.