1. You did something new and it works
2. There is this conference that you want to attend, for whatever reason
3. Your supervisor asked you to submit
4. You need publications for graduation, progress review, qualifier, etc.
5. Any other reason
The ideal situation is that the reason is the first. In this case, you can just write what you finished. In case of a conference, you might even write part of what you did so that you can later write a longer article to a journal.
If you want to write because of one or more of the other reasons, things are a bit tricky. To write a research paper, you need to know and/or have done the following:
1. Have a problem to solve
2. Read about whether and how others tried to solve that problem
3. Suggested a method to solve that problem
4. Tried to solve the problem using that method
5. Tested whether your method works
6. Obtained results
If you have done all of the above during the past few months and haven't written about it yet, you are all set. You can start writing.
If you have done only 1 and 2, you can still write a survey paper (preferably to a journal). But for this, you should have read at least 100 papers. This option is for your first year in PhD.
If you have done 1, 2, 3, and 4, you can still write a "short paper," "poster paper," or "work in progress paper" as they would call it. Another option is to start writing while you work on the steps 5 and 6. I don't recommend this, though.
So much for today. My next post will tell you how to make an outline of the paper, using the work that you selected.