Without knowing what type of surgery or injury it was, I'll just outline what helped me. A few years ago I strained my rotator cuff in my left shoulder. Although certainly not as serious as a tear (and not requiring surgery) it did require some careful planning to get back to working out.
http://familydoctor.org/265.xml has some good exercises that really helped my shoulder feel a lot better. Additionally, you should have a physical therapist to take you through some exercises as well (bands are popular). From personal experience, doing these will help tremendously.
Another exercise that has helped are lying shoulder raises (imagine the 4th exercise on the linked webpage but lying on your side instead and not raising the dumbell quite as much as 45 degrees).
One more thing. Avoiding some exercises is as good as doing others. Avoid behind the head military press or lat pulldowns and beware of taking your upper arms past parallel on the bench press.