Ceiling Fans Should Have Three Wires Including Ground. Black, Blue(or Red) and white. Green or Bare is your ground. The Other wire is your support wire that you just loop it to a secure screw or hook depending on the model/make of the fan. Before trying to figure out the wiring open the light switch box like terry mentions to find out whats there
1) Find your neutral(white) and tie them together.
2) Find your Switch Wire Where It Should Be Just One Black Wire Unless you have multiple lights controlled by one switch.
3) "3 sets of wires in the box,3 blacks tied together, 1 white hooked into another white,then the 2 whites"
im going to assume one of your 2 white wires is your control/swtich wire.