What do they do to help depressed people in the psychiatric hospital?

More attention. Keep closer eye on them, adjust meds quicker, more intensive therapy, sometimes ect, medical/neurological evaluation, social history, family/marital therapy, groups classes, etc.
Speed up recovery. In a hospital you are evaluated and treated for any medical issues affecting your health. You see a psychiatrist every day for rapid evaluation and starting of medication if needed. Also you receive daily therapy. All of your medical issues are monitored closely. Although hospital is not just to relieve stress, one can take time away to evaluate your life ; and make a good outpatient plan.
Safe stabilization. Is the ideal goal in a perfect world. Circumstances vary widely, so do outcomes. Unnecessary admissions (not always obvious) return home and to outpatient care in a day or two if no threat is posed. Rapid team psychosocial and medical assessment develops a treatment plan for outpatient care or a move to more intensive care. Not all hospitals are equally effective, sadly. Money is always an issue.