The output speed sensor is on the upper left of the transmission with DkGrn/Brn and DkGrn/Vio wires. It's attached with a small bolt. There's no repairiing it if it's faulty, you will need to replace it.
RepairPal Certified shops can diagnose and repair your 2004 Dodge Ram 1500. They provide transparent pricing with a minimum 12-month or 12,000-mile warranty on repairs and services.