This is exactly how a normal stock exchange works.
The quoted rate and the Buy and Ask prices are just driven by the supply and demand of people wanting to trade on that exchange.
BTC-e operates an order book. Sellers add Sell orders with an Ask price which they are happy to sell at (This is called a Limit order)
Buyers places Buy orders with a buy (or bid) price they are willing to pay.
The difference between the two prices is called a spread.
So if you place a Limit Buy order, but it is below the lowest Sell order then your order gets placed in the order book. If it was higher than the highest order, already in the order book, then the quoted Bid price will increase to the price you Bid at. Now if later someone else places a sell order at or below your bid price, then the order book will match your order and it will become a trade. (and vice versa).
When this happens. your orders are taken off the order book* and the next lower Buy order and next higher Sell order will become the new Bid and Ask prices.
Now if you want to make a Buy (or Sell) Trade right now:
You can place a Market order which you say you want to Buy (or Sell) X number of coins (or shares on a stock market) i.e., you don't give a price.
When you do that, the BTC-e order book software will match the lowest sell limit order (or highest buy order when you are selling) and create a trade right away.
Which is the right order type to place, that depend on your trading strategy and is a whole other topic.
The rate quoted is normally the last price that a pair of orders that was matched at.
*It is slightly more complex than that, because you have partial fills, but you get the idea.