Voting is done with AJAX. Take a look at the qa_vote_click function in qa-content/qa-page.js
You can trigger that from an input element with a name property, for example the upvote on this page is
<input title="Click to vote up" name="vote_57443_1_q57443" onclick="return qa_vote_click(this);" type="submit" value="+" class="qa-vote-first-button qa-vote-up-button">
In "vote_57443_1_q57443" you have the postid (57443), the vote (1 for upvote, -1 for downvote) and an achor link (q57443) which is used as a hook to display any error message returned.
A lot of this is ingrained into how Q2A itself works, for example it returns the HTML needed for the theme. So to do this from outside the code, you may find it simpler to make your own AJAX request. You'd make an AJAX POST request to the Q2A root URL (e.g. yoursite.com/qa/) with the following parameters:
{
qa: 'ajax',
qa_operation: 'vote',
qa_root: /* Q2A root URL */,
qa_request: /* current page */,
postid: /* the post ID */,
vote: /* 1 or -1 */,
code: /* security code from qa_get_form_security_code() function */
}