The original button is chosen at random.
The person on his immediate left is the small blind and posts half the minimum bet.
The player to the small blind's left is the big blind, and posts the minimum bet.
At most live games I've played in people either draw cards for position (Ace through 9 or 10, with the ace being the button, 2 being the small blind, and 3 being the big blind) or you draw a seat number, with #1 being the button, #2 being the small blind, and #3 being the big blind.
In the next hand everything shifts one position to the left (clockwise). The person to the left of the big blind ("under the gun") becomes the big blind, the big blind becomes the small blind, and the small blind becomes the button.
Rush poker is an exception. In that case, the computer looks for who at the table hasn't posted the big blind in the longest amount of time and makes that person the big blind. The person to his right is the small blind, the person to the small blind's right is the button.