At the risk of being trite, research is about creating new knowledge (that's really the underlying condition for PhD acceptance, did you do something new - and worthwhile, and enough of it). However, like JeffE commented, how this is done in CS varies from area to area, quite significantly.
For my area, it's quite like a lot of mathematics research, it all revolves around developing new theorems about properties of problems or computational models &c. (so you think, then think some more, write it down, realise it's wrong, go back to thinking, talk to someone else, think a bit, write something done... until you have something that is "enough")
For other areas, say data security, research might involve developing and implementing new security protocols, or cryptographic algorithms (though in data security, there's also the mathematical theory part, so it's not all the same).
As for why you do it, that's kind of up to you. At one level you're contributing to human knowledge in a way that will hopefully be useful, however the underlying reason a lot of people go into research is really because they love the area they're in, so the "why" is quite personal. You really do have to love it though, as research is usually slow, misunderstood by others and often disheartening - until you get that moment when you have a result (then you go back to the start).
Where the ideas come from is also a tricky thing. If you're thinking far in the future, they come from you, but this isn't as hard as it sounds, once you start to get into a particular discipline, you (should) start asking questions about why things work certain ways, how they can be improved, how they can be combined with other things. Some of these questions will already have answers, others won't, that's where you start the research. In the short term however, you will likely not need to come up with the overall questions and directions for your research, you will be part of your supervisor's research project(s), and they will give you a starting point. Note that they don't necessarily know how to get the answer either, that's why it's research, a lot of excellent students come undone at this point because there's no definite answer, they can't just check things when they're unsure, so you have to be prepared for uncertainty and incomplete knowledge (its your job to complete it!).
Publishing standards you'll also learn from your supervisor, and from reading papers in your area. You'll quickly figure out how much goes into papers of different types.