That's a really broad question.
If you already know which keywords you want to rank for then you have half of the battle won, if not then do some keyword research to find keywords that you want to rank for.
The next thing you must do is to analyze the competition to see what you're dealing with. If the top 10 results are just forums threads, yahoo answers, social posts and some low quality blogs or websites with no proper SEO then you know it won't be hard work to rank for that keyword.
If you only see blogs and websites with no forum threads or question and answer websites then you have to check those sites SEO. Check their on-page SEO then after you must check their off-page SEO. Depending on your experience you can be able to determine whether you can outrank them or not and how long it will take you.
Some keywords may require a couple of months while others will just need a few weeks.
Do some proper on-page seo for your website and make sure you have high quality content that is worth sharing online. You must also submit your sitemap to Google and Bing webmaster tools so that these search engines can index you site. This will help yahoo, bing and google know about your site and they'll let you know if your site has some errors that might affect your rankings (you'll get error messages).
Have good metadata for your pages to make it easy for search engines to know what your page or post is all about. Also have a good on-page linking structure (internal linking) for your website.
Once you have the on-page part set then you can now move on to off-page. Get other websites to link to your website. If you have good content then you can use social media, blog commenting and forums to drive traffic so that people can generate some organic backlinks for you.
You can also do some guest posting to get some traffic and backlinks, they might not be strong backlinks but they're good links (depending on the site you're guest posting on). Avoid adding your site on the author resource box, have your link within the article and link to different pages with each guest post.
Get some resource pages with dead links and ask the webmaster to replace the dead link with yours or ask for link exchange. You can go around begging for links or simply create your own private blog network.
The more high quality backlinks you have the better chance you have to outrank your competition. You don't need thousands of backlinks, just a few quality backlinks will work. Not crappy backlinks like social bookmarking, yahoo answers, forums, blog comments, directories (most, not all are bad), article submission, profiles etc.
Your question is really broad but hope that helps