computer data consists of ones and zeros. Compression works two ways - first it eliminates repetition.
if there is a section of the data that consists of a 1000 zeros in a row, instead of writing 0 1000 times, compression software just includes the instruction to "put 1000 zeros in this spot"
The next thing is does is to use a library of shorter segments to replace commonly used longer segments. The English equivalent is to use abbreviations, much like typing Mr. for Mister or Apt. for apartment, but on a larger scale.
Not all data compresses well. Some file types use built in compression. For example, bitmaps - .bmp files compress a great deal because they contain a lot of repetitious data. .JPG files have compression included in the file format, so if you attempt to compress them further you gain little. In fact, if you zip a .jpg the file may actually increase in size.