Also, the Skylink runs in both directions. Going en either direction will get you from B to D, but one will be quicker while the other one will take you on a nice tour of all the other terminals, so just pay attention to the signs if you want to minimize your Skylink experience.
During your return you will be deposited outside security once you leave the customs area, it's not a choice, it's just the way it works. You could go through security in D and then take the Skylink to B or whatever terminal your return flight home will be departing from, or as already suggested, you could take the terminal shuttle to the terminal and go through security there. I would suggest going through security in D and taking the Skylink.
Have a great trip!