Query the database after get_header() has been included

Your question is vague: i’ll try to be as specific as possible.

The basic rule is: if you need to modify the default query, use pre_get_post
If you need to display another list of results than the one linked to your template url, use get_posts.

I find this documentation to be quite useful
http://developer.wordpress.com/2012/05/14/querying-posts-without-query_posts/

Doc on pre_get_posts
http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts

Doc on get_posts
http://codex.wordpress.org/Template_Tags/get_posts