Some substances are secreted from the plasma into the lumen by the cells of the nephron. Examples of such substances are ammonia (NH3). As in reabsorption, there are transporters on the cells that can move these specific substances into the lumen.
Now let's put all of these processes -- filtration, reabsorption and secretion -- together to understand how the kidneys maintain a constant composition of the blood. Let's say that you decide to eat several bags of salty (NaCl) potato chips at one sitting. The Na will be absorbed into your blood by your intestines, increasing the concentration of Na in your blood. The increased Na in the blood will be filtered into the nephron. While the Na transporters will attempt to reabsorb all of the filtered Na, it's likely that the amount will exceed their ability. Therefore, excess Na will remain in the lumen; water will also remain, due to osmosis. The excess Na will be excreted into the urine and eliminated from the body. So whether a substance remains in the blood depends on the amount filtered into the nephron and the amount reabsorbed or secreted by various transporters.
Let's look at an another example: Why do you have to keep taking repeated doses of any given medicine? Well, once you take the medicine, it gets absorbed by the intestine into the blood. The medicine in the blood acts on its target cell and also gets filtered into the nephron. Most medicines don't have transporters in the nephron to reabsorb them from the filtrate. In fact, some transporters actively secrete medicines into the nephron. Therefore, the medicine gets eliminated in the urine and you must take another dosage later.
We've seen how the kidney can regulate ions and small molecules and eliminate unwanted substances. In the next section, we'll see how the kidney maintains water balance.