The Mass Air Flow Sensor (MAF) on a 2004 Ford 3.9L engine is typically located in the air intake tube,
between the air filter housing and the throttle body. It's a relatively easy-to-spot component; it's usually a small rectangular or cylindrical box with a wire harness plugged into it.
To be absolutely sure, you should consult a repair manual specific to your 2004 Ford vehicle with the 3.9L engine. A diagram showing the location will be very helpful. You can often find these online for free or purchase one from an auto parts store.