Play-hookey is a good site to learn how DFFs are built from elementary gates. Start with the RS Nand Latch.
The basic storage element in sequential logic is cross coupled Nand (or Nor) gates:
This circuit is stable in either state when the /Set and /Reset inputs are high. The simplest explanation for why one state or the other will occur at power up is that /Set or /Reset will go true before the other since there is no such thing as simultaneous in the real world.
In the real world, power doesn't come up instantaneously either. It can take several milliseconds for the power supply to provide stable, full voltage, power. This is where the dirty secret of digital hardware is exposed:
there is really no such thing as digital hardware. All digital hardware is actually very high gain analog circuits. At that level, IC designers need to be analog engineers and ensure that their circuits behave sanely under the abnormal conditions during power up.
--Mark