when replacing a compressor you will need to also replace the accumulator, oriface tube. When your compressor gets worn it starts sending pieces into the compressor stream. These tiny bits and pieces will travel into the condenser and then into the oriface tube. When you pull the oriface tube you should see how bad it gets clogged with debris. When you remove the compressor, the accumulator and the oriface tube, you use AC flushing fluid into the lines and push the fluid through the lines. (usually in the reverse direction) There are some tools that will pump the liquid through as a liquid and then captures the liquid and debris on the other end of the open system. Some tools use compressed air to push the fluid through and you need to cover the other end of the open system with a rag or something to capture the fluid and debris coming out the reverse end of the open system, You want to backflush the entire system while the compressor, oriface tube and accumulator are out of the system. When you decide that the system is cleaned of debris, use compressed aid to push all the flush fluid out and dry the system out.
when you go to install the compressor and other parts to will need to add oil to the accumulator, add some to the condenser and follow the directions for adding oil to the compressor. Some compressors come filled with oil others come empty. You will need to look at the instructions for your particular compressor. Regardless of your compressor instructions, you should always measure how much oil you can take out of the old compressor. It will be the best measurement of the oil that should be left in the new compressor. If the amount recovered is less than a certain amount, the instructions for the new compressor should tell you the minimum amount you should add to the new compressor.