The NBA Draft is an even that happen once a year where the 30 teams from the association get to pick the best players out of college or overseas basketball into their rosters.
The format is composed by two rounds of 30 picks, and regularly unless the team has traded his pick before, each organization gets two picks.
The order is established by the NBA Draft Lottery, which is an event where the teams who did not make the playoffs in the past year participate in a lottery to see who gets the first overall pick. The team with the worst record receives the best odds of receiving the first pick. Basically, the worst teams do in the regular season, the best players they'll get in the draft.
College players who have finished their college career are automatically eligible for it, while the freshmen, sophomore and juniors have to declare for the draft and give up their remaining college eligibility.
It is not allowed for High School players to declare for the draft, so they are forced to go to college or to an overseas team for a year and then announce they'll be going the event.