If you don't know how it works, don't build one and don't ask how to build one. jeez.
With that being said, I'm glad that you ask how it works. Protein skimmers are also called foam fractionaters, however that is the old name. One day, some German dude dropped an air stone in the saltwater, and didn't pick it up. He then noticed the slime that was coming up the side of the glass and decided to try and experiment to see what it does.
Ends up what happens is that microbubbles have the ability to cling to dirt particles, some ammonia, trace elements, nitrate, phosphate, and several other dirty things in your tanks water column.
By chopping up air into microbubbles, the longer the bubbles are in direct contact with tank water the more dirt they uptake. Skimmers with longer and thicker bodies usually work best. The bubbles are then collected in a cup with the dirt. Everything combined is called "skimmate" which is usually thick or like a green tea - depending on if you dry skim or wet skim.