Dirty electricity filters how do they work?
It is hard to figure out what your real problem is.  Knowing that would have really helped in crafting a good answer for you.  

Your question is, "How do these things work"?  But that question is premature.  Here are some questions, in order of how they should be asked:


What do they claim the problem is?
What do they claim that their product does?
Are their claims plausible?
Are there any known uses for electronics that can make their product legitimate?


Since you don't link to the device, I have to guess on the possible answers to these.

Most claims for #1 is that noise on the power line can cause:  health problems, noise in your home stereo, or wasted energy.  

The claims for #2 is that they filter out the noise.  The source of the noise is not always clear, and how it filters it out is also not clear.  

EMR causing health problems is not plausible.  There are a lot of scientific papers done on this subject, but there is a trend:  The better the research (placebo controlled, double blind, large sample size, etc) the less likely EMR will cause health problems.  Good research shows no correlation between EMR and health problems, but bad research shows a link.  This is a common trend for other things too (acupuncture, homeopathy, etc.).

EMR causing wasted energy is plausible, but still stupid.  EMR in your power lines will be a low level.  Much less than a watt for your whole house.  But appliances, computers, etc consume hundreds of watts.  So even if you could fix this (assuming it even needs fixing) it would only result in much less than a 1% energy savings.  You can then do the calculations to figure out how long it would take to break even:  where the amount of money you save matches the amount you spent on the device.  Of the devices I have seen, it would take years to break even.

EMR in your power lines causing noise in your home stereo is the most plausible, but still not reasonable.  The power supplies in these devices is designed to filter out noise.  If EMR in your power lines is actually putting noise into your stereo then either the amount of power line noise is unusually high (unlikely), or your stereo is terrible.  I design professional audio equipment for a living and having power line noise get into the audio is simply unacceptable.  If there is a product that makes it to market where power line noise is an issue then the guy who designed that product should be fired.

So, their claims are either not plausible or not important.  

Finally, there are no known things that you can plug into a normal outlet that will eliminate EMR from the power lines.  I am specifically talking about devices that just plug into an outlet (with no pass-thru connector) and somehow remove EMR from the entire room or entire house.  If the device had a pass-thru connector, or if the structure of the house wiring was known, then it could be possible.  

But let's say that we were doing a pass-thru.  The the filtering would be done using a mix of inductors and capacitors.  These are called LC filters.  These are fairly inexpensive devices.  It might add US$2.00 to the cost of a power strip.  Certainly not enough to justify the cost that these people tend to charge.

Conclusion:

These devices are not solving a real problem.  It is unlikely that they do anything at all.  They are expensive for what they claim to do.  In short, don't bother with them.  I would go so far as to call a lot of them fraudulent.