OK I've set up an experiment, and it works pretty much like I suspected, in that the server-side processing is carried out before any of the test scripting is run.
So in my example, where I have two versions of the search algorithm, the order of execution would be:
user submits search
server processes search
the client-side code executes and (conditionally) redirects to the page to the alternate search page
So the main processing page will run regardless. This is fine from the point of view of Google analytics collecting data, but not so great for the user, as they may have to wait for two complete searches to execute, which is a couple of seconds for each page. This would also make the test page appear slower to the user, which would skew the results.