This is a good question, but keep in mind that when you ask a broad question, you typically get a broad answer - ie, I won't go into much detail.
In general, belief and attitude formation is thought to be implicit, rather than explicit. That is, when you ask someone for their belief or attitude, it may appear as though they simply look (introspect) into the part of their brain that encodes that belief or attitude, and then report on it. However, in experimental setups, beliefs and attitudes often appear to form in the process of reporting about them. A well known example of this is choice blindness, in which the initial act of explaining choices not actually made, forms subjects' subsequent attitudes.
Once formed, attitudes seem to persist through counterevidence. For example, suppose a person is provided with evidence that a fact is true, followed by evidence that it is false. If the evidence sources carry the same weight, then in total, the person ought to be ambivalent about the fact's truth. However, in experimental conditions, the first piece of information carries more weight than the second - that is, more evidence is required to change an attitude than it does to form it.
Well known examples of this effect include belief perseverance, in which the effect of initial evidence provided persists after being discredited; anchoring (and similar conservatism bias), in which the first piece of information provided disproportionately affects subsequent judgements; and the illusory truth effect (and similar continued influence effect), in which even a single exposure to false claims is not undone by subsequent discrediting information.
In real-life situations, beliefs and attitudes are often not formed in isolation as they are in a lab. Thus, while a person being exposed to a new fact might form a new belief, they may instead relate it to a pre-existing belief. For example, when choosing between a mainstream or conspiracy theory, a person may prefer the first piece of information they are exposed to, as in a lab, or they may have pre-existing reasons to prefer one view over another.
The most common general framework for understanding the process of balancing new beliefs with pre-existing attitudes is that of cognitive consistency, which is a preference for our beliefs and attitudes to be congruent (not contradictory). This framework encompasses several well-supported theories, such as cognitive dissonance, self-perception theory, and balance theory, each of which proposes a slightly different underlying mechanism.
In summary, as a rough guideline, attitude formation balances overly-weighted initial evidence with the need for consistency across all beliefs and attitudes.