You can get a good diagram by searching "3 way switch diagram".
You have a white red and black wire the red is the common in the junction box where the fan or light is hook the red to red the black to the power wire of the fixture the whites together. Then on the switch hook the reds to the common terminals usually designated by a C then hook the black and white to the other making sure you keep them the same