You are citizen of an EU/EEA country or Switzerland
Then you do not need a resicence permit for studying in Germany.
You are citizen of a NON-EU/EEA country
If your visa does not cover your whole stay in Germany, you must apply for a resicence permit at the local immigration office at least two months before your visa expires.
These are the documents you have to hand in, when applying for a residence permit:
Valid passport with visa and photocopies of all printed pages
Up-to-date biometrical photograph (35x45mm)
Proof of health insurance coverage
Proof of enrolment at the University of Cologne (from KLIPS 2.0)
Proof of financial resources to cover your stay in Germany
Copy of rental contract
Residents' registration confirmation
You are citizen of Australia, Canada, Israel, Japan, New Zealand, the Republic of Korea or the United States of America and you entered Germany WITHOUT a visa: Then you must apply for a resicence permit at the local immigration office within 90 days after entering Germany.