To be more detailed: For a given region, the algorithm schedules the lowest-cost sources first and keeps adding higher and higher cost sources until it reaches necessary generation capacity. Then, everyone is paid the same rate as the the marginal watt that just got scheduled. As a consequence, sources of power which cost money to shut down, like nuclear plans, will actually bid negative into the market to ensure they are scheduled. This is followed by low-marginal-cost plants like hydro dams. Then coal, which is relatively cheap. Then natural gas which is more expensive (or at least was before fracking) but the turbines for which can respond quickly. This actually happens twice as they run this market once the day before based on predictions and then run an adjustments market in real time. IT is actually possible to sell power in the day-ahead market and sell it in the real-time market without owning any generation capacity and do arbitrage. Another way to do arbitrage is to build two reservoirs and pump water to the higher one at night when power is cheap and then generate hydro power during the day when power is expensive [1]. You can also use flywheels or batteries. There are also markets for ancillary services like standing by ready to generate electricity or decrease generation with a few seconds' notice.
[1] http://en.wikipedia.org/wiki/Blenheim-Gilboa_Hydroelectric_P... Source for the rest of this: I interned at the New York ISO four years ago. Read more here: http://www.nyiso.com/public/about_nyiso/understanding_the_ma...