When your kidneys filter your blood to remove waste products, they initially pass the blood through a membrane that removes large molecules like proteins but permits waste products, salts, water molecules, amino acids and sugars like glucose to pass through. In order to ensure that valuable molecules like glucose and amino acids aren't excreted together with the waste products, the kidney must reabsorb them, a process that takes place in the proximal tubule.
Blood flows into the kidney through the renal artery, which branches and subdivides into smaller vessels to supply blood to the nephrons. The nephrons are the functional units of the kidney that carry out the actual filtration and reabsorption; there are hundreds of thousands of them in adult human kidneys.
The blood flows through a ball of capillaries called the glomerulus; here the blood pressure causes water, dissolved salts and small molecules like waste products, amino acids and glucose to leak through the capillaries' walls into a structure called Bowman's capsule. This initial step removes waste products from the blood while preventing the loss of cells like red blood cells or proteins, but it also removes valuable molecules like glucose from the bloodstream. Hence the next step in the process: reabsorption.
Reabsorption takes place in the proximal tubule of the nephron, a tube leading out of Bowman's capsule. The cells that line the proximal tubule recapture valuable molecules including, of course, glucose. The mechanism by which they do so is different for different molecules and solutes. For glucose there are two processes involved: the process whereby glucose is reabsorbed across the apical membrane of the cell, meaning the membrane of the cell that faces out onto the proximal tubule, and then the mechanism whereby the glucose is shunted across the opposite membrane of the cell into the bloodstream.
Embedded in the apical membrane of the cells lining the proximal tubule are proteins that act like tiny molecular pumps to drive sodium ions out of the cell and potassium ions in, expending stored cellular energy in the process. This pumping action ensures that the concentration of sodium ions is much higher in the proximal tubule than in the cell--like pumping water to a storage tank atop a hill so it can do work as it flows back down. Solutes dissolved in water naturally tend to diffuse from areas of high to low concentration, so the sodium ions want to flow back into the cell. The cell takes advantage of this concentration gradient using a protein called the sodium dependent glucose cotransporter 2 (SGLT2), which couples the cross-membrane transport of a sodium ion to the transport of a glucose molecule. Essentially, the SGLT2 is a little like a glucose pump powered by the sodium ions trying to get back into the cell.
Once the glucose is inside the cell, returning it to the bloodstream is fairly simple. Proteins called glucose transporters or GLUT2s are embedded in the cellular membrane adjacent to the bloodstream and ferry the glucose across the membrane back into the blood. Usually the glucose is more concentrated inside the cell, so the cell doesn't need to expend any energy for this last stage; the GLUT2 plays a largely passive role like a revolving door that allows the outbound glucose molecules to slip through.