You'll need to pick up a PowerBridge type device, they allow you to have an inlet in one location and an outlet in another.
![enter image description here](https://i.stack.imgur.com/HX1Cv.jpg)
You'll connect the inlet to the outlet using cable rated for the appropriate load (14/2 Romex most likely), this insures everything is up to code (since it's not proper to run extension cords through walls).
To make the outlet switched, you'll simply connect a switch on the hot wire of the cable between the inlet and outlet devices.
![enter image description here](https://i.stack.imgur.com/M6zc8.png)
The reference to a switch loop in the related question describes a pair of wires that are both hot or live. The white wire is serving as a black and should have a black marking or tape on it. The switch is serving as a break in the hot line.
Every operating device (like a fan or lamp) in standard wiring needs a hot line and a neutral line, and usually a ground, although that is not strictly necessary in all circumstances. In the wiring described in the other question, there was no neutral running through the switch box, but there had to be a neutral connected to the device itself, in the box that the fixture was attached to. The neutral wire is never switched, so only the hot lead was routed to the switch loop. Modern code requires that new switch circuits also have a neutral present, since some newer switch devices need a neutral to function.
Your situation may be different. On your circuit, one of the three boxes is closest (electrically) to the main panel. There is a live circuit line running either to one of the outlets or to the switch box. In either case the outlets you describe must have a neutral wire present as well as a hot wire.
If you want the fan to be switched on and off by the same switch as the outlets, you can simply add a wire from either outlet box to the fan location and connect all wires in parallel (black/white/ground).
If you want a separate switch for the fan, you need to tap into the power where the live circuit comes in to the room. It may be either of the outlets or it may be the switch box (if there is a neutral in that box). You need to tap into the unswitched hot, run that hot to a new switch and connect the neutral and ground in parallel. Then run the full cable from the new switch to the fan.
If you want to use separate hard wired switches for fan and light, run 14/3 from a switch box fed by the always hot line, using the two hots separately for the two features.
An alternative if you want separate switching is to run a full cable (14/2 or 12/2) directly to the fan from the box that has an unswitched hot. Use a fan that has a hand-held or wall mounted remote and wire the fan as always hot (no line switch). Then the remote controls whether power is going to the fan. This also simplifies installing a fan/light combination.
As to your other outlets, white wires are generally not hot unless used to connect to switches and should be so marked. Most white wires are neutral. You can test your outlets for correct wiring with a plug-in tester like this one.
.
If the tester reveals miswiring, you should consider calling in a pro. It also sounds as if you are not too familiar with wiring in general, so you may want to enlist the help of someone with a bit more experience until you become more confident. In any event be sure to turn of the circuit breakers before opening any box and confirm wire are not live with a non-contact tester like this one
![non-contact tester](https://i.stack.imgur.com/p20fP.jpg)
images and links are for illustration only, and not an endorsement of goods or sources
Best Answer
You must do your shopping for smart home devices. Specific product recommendations are off-topic on this Stack Exchange (although I did give a specific example in a comment).
What you’re looking for tho is a wall switch that acts as a controller for one lamp, and a plug in module for lamp 2. You don’t need to sense voltage at all, you just need a smart switch that will turn on another device as well as itself. In some cases you may or may not need a particular systems hub. I would also watch out for systems where internet connection is required for the setup to operate correctly.