The best way to know if a sentence is grammatically correct is to first review the text for the most common types of grammatical errors and then to use a grammar checker, such as Grammarly, to ensure no mistakes have been missed. It is important to have a basic understanding of sentence construction to write the best sentences possible, as there is no tool or software that can fully compensate for lacking this knowledge.
There is an abundance of print and digital resources available for writers who want to ensure that their sentences are correct. Some of these, such as Strunk and White's Elements of Style, contain pages and pages of rules that go into a great deal of detail. There are certain errors in sentence construction, however, that are so common they tend to show up on almost every list and writing guide. These are sentence fragments, run-on sentences, lack of subject-verb agreement and discrepancies in parallel structure.
To determine if a sentence is correct, read it aloud. Ensure that each sentence has a subject and a verb and expresses a complete thought. Look for run-on sentences that would serve better as two sentences, particularly the dreaded comma splice (instances in which a comma is inserted between two complete sentences). Make sure the main subject and verb of the sentence agree, meaning a singular subject should have a singular verb and a plural subject needs a plural verb.
Finally, compare the separate parts of the sentence to make sure the parts go together and the form is consistent. Once the writer has reviewed a document thoroughly to ensure that each sentence follows the rules of grammar, it is useful to employ a grammar checker such as Grammarly to check spelling and help identify any remaining grammatical errors.