A dialysis machine tries to mimic some of the functions of a human kidney. One of the primary jobs of a kidney is to remove urea and certain salts from the blood so they can exit the body in urine.
In a dialysis machine, blood from the patient runs through tubes made of a semi-porous membrane. Outside the tubes is a sterile solution made up of water, sugars and other components. Red and white blood cells and other important blood components are too large to fit through the pores in the membranes, but urea and salt flow through membranes into the sterile solution and are removed.
Here are some interesting links: