When, how, or why something is done is expressed by an adverb, whose primary function is signaled by its name: Adverbs modify verbs (and sometimes other parts of speech — more on that later). They appear more or less in proximity to the verb they modify, but their syntactical location can vary for diverse reasons.
An adverb often follows a verb: “I stated the rule clearly,” but it can precede the verb (“I clearly stated the rule”) and even the subject (“Clearly, I stated the rule”). Note, however, that the latter form can be confusing: Does the sentence mean that I succeeded in my attempt at clarity, or is the sense that it is obvious that I stated the rule? The sentence, or one that precedes or follows it, must include context. Also, punctuation can change the meaning: “I stated the rule, clearly” differs in sense from “I stated the rule clearly.” (The version with the comma connotes that the writer believes that the fact is obvious.)
And what if a sentence includes two or more verbs? Place the adverb to make it clear which verb it modifies: “She drove quickly to the store and selected a hat” (or, again, “She quickly drove . . .” or “Quickly, she drove . . .”) describes a lead-footed motorist, while “She drove to the store and selected a hat quickly” (or “. . . quickly selected a hat”) suggests an impulsive, determined, or hurried shopper.
Adverbs are applied to infinitives, which are verb phrases beginning with the word to. The pedantic admonishment against inserting is challenged in this previous post by another DailyWritingTips contributor; suffice it to say here that such sentence constructions as “He sought to successfully challenge the champion” (rather than the awkwardly hypercorrect “He sought to challenge successfully the champion”) are valid.
Adverbs, curiously, also modify adjectives (themselves modifiers), prepositions, and even other adverbs. In “They were nearly correct,” for example, nearly modifies not the preceding verb were but the following adjective correct, and in “She and I met right on that corner” right modifies the prepositional phrase that follows, rather than the verb before it. “We quite rightly refused,” meanwhile, quite modifies its fellow adverb rightly.
Adverbs change position depending on whether they are employed in declarative statements (“He really is that gullible”) or interrogative sentences (“Is he really that gullible?”). Also, they often have distinct meanings based on their position in a sentence; for examples, see the section “Misplaced Words” in this post.
Some writing guides seem to give adverbs a bad rap, but read those resources carefully: The more sensible among them advise, as I do in this previous post about adverbs, hesitation in their employment only because their liberal use is often associated with limp verbs. And do take care to locate them correctly and effectively.