Specifically for onsite optimization (also called onpage optimization) you need to look at some of the following factors:
- html title tags (proper length and use of keywords)
- keywords and description meta tags with call to action and proper keyword usage
- one h1 tag on each page with relavent title
- judicious use of h2-h6 tags
- images should have proper description in alt tags
- image names should be descriptive and keyword rich
- linking to internal pages with proper keywords in the anchor text
- moving all styles and script code in separate files and not including them on page
- xhtml validation
- latest semantic indexing techniques to write the page content
- site map page
- several other things
Hope that will help you get started.