It is done with a petition. A petition is made by the people to candidate someone and if enough people sign the petition then the candidate will become an official one and will be available for general election. They are not related to the main two parties and can often take away their votes in those states.