The lottery is normally held during either the third or fourth week of May.
To determine the winner, fourteen ping pong balls numbered 1–14 are placed in a standard lottery machine and four balls are randomly selected from the lot. Just as in most traditional lotteries, the order in which the numbers are drawn is not important. That is, 1-2-3-4 is considered to be the same as 4-3-2-1. So although there is a total of 24 (4!) orders in which the balls numbered 1-2-3-4 can be picked, they are all treated as the same outcome. In doing this, the permutation of 4 balls from 14 becomes the combination of 4 balls from 14. That is, the total of 24,024 (14! / 10!, or 14x13x12x11) possible permutations is reduced by a factor of 24, to 1,001 combinations (or 14! / (10! x 4!)). Of these, 1 outcome is disregarded and 1,000 outcomes are distributed among the 14 non-playoff NBA teams. The combination 11-12-13-14 (in any order that those numbers are drawn) is not assigned and it is ignored if drawn; this has never occurred in practice.
In the event a lottery pick is traded to another team, the record of the original team (whose pick it was before the trade) still determines eligibility for the lottery, and assignment of chances.
As of 2013, with 30 NBA teams, 16 qualify for the playoffs and the remaining 14 teams are entered in the draft lottery. These 14 teams are ranked in reverse order of their regular season record and are assigned the following number of chances
1.250 combinations, 25.0% chance of receiving the #1 pick
2.199 combinations, 19.9% chance
3.156 combinations, 15.6% chance
4.119 combinations, 11.9% chance
5.88 combinations, 8.8% chance
6.63 combinations, 6.3% chance
7.43 combinations, 4.3% chance
8.28 combinations, 2.8% chance
9.17 combinations, 1.7% chance
10.11 combinations, 1.1% chance
11.8 combinations, 0.8% chance
12.7 combinations, 0.7% chance
13.6 combinations, 0.6% chance
14.5 combinations, 0.5% chance
Here are the odds for each seed to get specific picks if there were no ties (rounded to 3 decimal places):
In the event that teams finish with the same record, each tied team receives the average of the total number of combinations for the positions that they occupy. In 2007, the Minnesota Timberwolves and the Portland Trail Blazers tied for the sixth worst record. The average of the 6th and 7th positions in the lottery was taken, resulting in each team getting 53 combinations (the average of 63 and 43). Should the average number not be an integer, a coin flip is then used to determine which team or teams receive the extra combination(s). The result of the coin flip is also used to determine who receives the earlier pick in the event that neither of the tied teams wins one of the first three picks via the lottery.
The lottery is conducted with witnesses verifying that all 14 balls are represented once as they are placed in the lottery machine. The balls are placed in the machine for 20 seconds to randomize prior to having the first ball drawn. The remaining three balls are drawn at 10-second intervals. NBA officials determine which team holds the winning combination and that franchise is awarded the #1 overall draft pick. The four balls are returned to the machine and the process is repeated to determine the second and third picks. In the event that a combination belongs to a team that has already won its pick (or if the one unassigned combination comes up), the round is repeated until a unique winner is determined. When the first three teams have been determined, the remaining picks are given out based on regular season record with the worst teams getting the highest picks. This assures each team that it can drop no more than three spots from its projected draft position.
A simple explanation: 1000 different outcomes of an experiment exist and are equally likely to occur. A certain number of outcomes is assigned to each non-playoff NBA team. The largest number of outcomes is assigned to the team with the worst record. The team with the second worst record gets the second largest number of outcomes, and so on for each of the 14 teams in the lottery. The experiment is conducted, and the team to which the winning outcome was assigned receives the 1st pick in the NBA draft. The experiment is conducted again. If the winner is the same team that already won, the experiment is performed over again until there is a different winner. The winner of the second experiment receives the 2nd pick. The winner of the third experiment receives the 3rd pick. After the 1st, 2nd, and 3rd picks are determined, the 4th-14th picks are assigned to teams based on weakness of record.