This is an in-depth article about screenplay formatting, but you can skim it or watch the short video embedded at the top.
And attached are two of the several sample files referenced in the article - a short general sample script and the full screenplay to Wes Anderson's The Royal Tenenbaums.
One thing which might not be immediately obvious concerning the formatting is that in screenplays the character name and parentheses are always centered, but the dialogue is indented and justified.
Let me know if I can give any additional information you might need.