The Rule 5 draft is held every December at the baseball Winter Meetings. Its a special draft to expose experienced players who were not protected by their organization. Draft order is determined by the standings of the prior season with lowest win% at the top of the draft. The players must surpass the requirements to be exposed. A team can block the player from being available by promoting them to their 40-man roster. The Rule 4 draft is the Amateur Entry draft.
Once a player is drafted by a team, they must be kept on the drafting team's 25-man Active Roster for the entirety of the subsequent season or else be offered back to the original team before demotion. Players who are placed on the disabled list are still considered as part of the drafting team's roster though they must be active for at least 90 days to prevent hiding the player on the DL. The roster rule only applies to the first full season after being drafted. The player may be demoted in subsequent seasons.
Data has been collected since 1997 for the Rule 5 draft. More information can be found on Wikipedia