NOTE:A trial by declaration does not require the same amount of formalitiy as a motion, and therefore has simpler paperwork to prepare and submit. If the judge rules against you in a trial by declaration, by law you get a new trial. Save the pre-trial motion(s) for the second trial (if you need it (them) -- if the grounds for your motion(s) are sufficient, you should win the trial by declaration).
If (after reviewing the strategy section of this tutorial) you intend to move for a dismissal on grounds such as a speed trap, you should consider a pre-trial motion. This makes it easier for the judge to justify dismissing the case. It also establishes a written record which may come in handy should you need to appeal.
Motions should be prepared in a format acceptable to the court. Your local law library can help you with this ( do not ask them about content, only the form; they should not give legal advice).
You will need to have the motions served on the court and the prosecuting attorney (the D.A, or City Attorney). If you do not know who the prosecuting attorney is, ask the court.
The motions will need to be mailed or delivered with a Proof of Service. Once again, your local law library can help you with the form for this.
A word on content -- keep your motion to the point and relatively brief. Cite the decisions and authorities which prove your case, but do not load the motion with extraneous arguments.
The exception to the above procedure is a request at your arraignment that the judge dismiss the case.
If the court does not grant your pre-trial motion or request to dismiss, the next step is the trial.