@Chad is correct that particular procedures will be determined on a state-to-state basis, and because of this, there are no hard-and-fast generalizations to make. The way Texas does it (where I'm knowledgable) is thusly:
For major-party candidates (Democrat or Republican), prospective candidates file with the county party organization in the county of their residences, and then the parties will conduct a primary whose winners will be placed on the general election ballot.
Minor-parties can do it basically the same way. However, there are some gotchas for the guy who wants to put a sign on his garage and call himself a political party. In Texas, minor parties have to meet certain requirements to be considered a political party:
- the party must have a legal organization
- it must have officers
- it must have publicly-posted rules / procedures
- it must have a name no longer than three words
Other details can be found in the candidate guide I linked. Minor parties nominate general election candidates in the same way that major parties do. If the party's nominee for gubernatorial candidate received more than 1%, then the party is entitled to place its candidates for state and county offices on the general election ballot. If the nominee received less than 20% of the votes in the last election, they may may choose between holding a primary election or nominating by convention. If the party's candidate received more than 20% in the last gubernatorial election then they are required to hold a primary.
Independent candidates may nominate themselves for state or county offices by submitting the correct application along with a petition with a number of signatures determined by the Elections Code for the different offices. A handy table of numbers of required signatures is published at the Sec. of State site.
But Wait! There's More!
Elections for municipal or other local offices (city councils, governing boards of schools, hospitals, etc) are nonpartisan by law, with the exception that home-rule cities may legislate partisan elections for themselves. These positions do not require petitions generally (with similar exceptions), and only require an application to be filed with the appropriate electoral authority (i.e., with the governing body of which the position sought is a part).