Great question, the answer is a bit counter intuitive. But first you need to make some assumptions.
Assume:
1) 100% isentropic efficiency
2) Heat Added = heat required to reduce discharged gas back to inlet temp.
3) No mechanical losses in compressor
4) No unrecoverable pressure losses in any portion of the flow stream
Needless to say, those are some rather broad and unrealistic assumptions, but what it says is that, with the exception of losses due to friction or other mechanical or fluid losses, we will compare the power needed to compress a gas isentropically to the energy removed to return the flow to the original temperature after compression.
I checked the results of this using a computer program that I use all the time where frictional and other losses can be added. I simply removed all losses to calculate the following.
Depending on the gas, the heat removed may be higher, equal to, or lower than the power required to compress the gas. They will be roughly the same.
In real life, losses typically result in more power being needed than is removed.
If you make different assumptions, the answer will also change.