How do I wire my ceiling fan with two switches (one for lights the other for fan)?
I suggest marking your wires with colored tape to indicate their function. 


Black=always-hot
Red=switched hot (fan)
Blue= switched-hot (lamp)


In your setup, the white wire in the /3 would get black markings on both ends.  So would the white wire between the switches.  The upper switch's red pigtail also needs a black marking; it is always-hot.  

In the /3 cable, mark black on both ends as blue.  

In the /2 cable between the switches, the black wire gets tagged with red tape on both ends. 

Now, considering that the tape color overrides the wire color, you simply match up by color!