Usually the publisher hires a developer to make a game. Meaning, like a movie, there money is generally fixed from the beginning. So no matter how good or bad they will get a certain amount of money. Now this will vary, but rarely. It usually varies when you have a very strong and well recognized developer that knows their game is going to be good. What they'll do is mostly fund their own project and then hire a publisher to publish it. Except this time they will get a fixed amount of money and a percentage depending on how well the game does. What that percentage is, depends on the contract.
For the most part publishers are going to rake in all the profits of a game. They unload so much money to a publisher to make it and then everything they sell to the retailers is what they get. Once they break even you are looking at pure profit.
Now all other people that make the game, such as the hardware manufacture, are paid off by the publisher at fixed costs. So if this game was being made for the 360, the publisher pays the developer, the people mass producing the disks, and licensing fees to MS. And if there are any other costs for engines that might be used or special design studios they used then these are all paid off before the game releases at a fixed cost.
Now the retailer and warehouses are the same people. The retailers own their warehouses haha. So what happens is the publishers sells them to the retailers. Now I'm not too sure how much they sell it to them for but they only get small profits off each unit of software sold. After that they are stored and warehouses and so many are sent to stores. From there on the retailer is selling for pure revenue to customers. Generally they need to sell most of the software they bought to break even. Leftover ones in warehouses are always bad. Because selling them amounts to pure profit. Not selling them goes at a loss.
Now this isn't the exact 101 guide but generally how it works.








