As seen in the answer by Thomas Pearne, οὗτος is a demonstrative pronoun. It is most often translated as "this" when singular. Here is a clear example from John:
The Jews then said, “It has taken forty-six years to build this temple, and will you raise it up in three days?” (John 2:20 ESV)
εἶπαν οὖν οἱ Ἰουδαῖοι τεσσεράκοντα καὶ ἓξ ἔτεσιν οἰκοδομήθη ὁ ναὸς οὗτος καὶ σὺ ἐν τρισὶν ἡμέραις ἐγερεῖς αὐτόν [mGNT]
While few translations render as such, the literal text of John 1:2 should be "this" as in Wycliffe's:
οὗτος ἦν ἐν ἀρχῇ πρὸς τὸν θεόν
This was in the beginning at God. (WYC)
Because the pronoun refers to the noun "the Word" which is later identified as Jesus, some translators choose to reflect that when translating:
He was in the beginning with God. (ESV)
The Word4
was with God in the beginning. (NET2)
4 tn Grk “He”; the referent (the Word) has been specified in the translation for clarity.
This One was in the beginning with God. (DLNT)
Some, like the ESV replace "this" with "He," which looks ahead to "Jesus." Yet "He" is not justified and is confusing at this point in the text as the pronoun is looking back to the previous verse and simply takes on the gender of the noun it is replaces. Here it means "the Word" which is masculine, not the Word who becomes flesh who is male. Also the etymology of οὗτος argues against "he" as οὗτος comes from the article ὁ and αὐτός, which is usually translated "him, his, or he." John's decision not to use αὐτός is another reason why "He" is not appropriate. John knows the identity of the Word, so the decision to use the pronoun which means "this" rather than the pronoun which means "He" indicates he wants the reader to understand "this."
Similarly, John's decision to replace "the Word" with the pronoun must be taken as intentional. That is, the NET translation which renders οὗτος as "the Word" is contrary to John's intention to focus attention on the pronoun. The Disciple's Literal New Testament adds One which is better than "He" or "the Word" but it highlights the essential issue in John's decision to replace the noun with a pronoun.
A case can be made that referent is any one of three of the uses of ὁ λόγος:
If the pronoun is meant to replace the closest noun, "this" is #3. But "this" is identified as being with τὸν θεόν which refers to #2. Finally, "this" which is in the beginning (ἐν ἀρχῇ) refers to #1. Effectively John has used οὗτος as a device which preserves the equality of the Word and God from the first verse while placing both the Word and God in the beginning to ensure the reader does not give the Word superiority to God (see below):
John 1:2. οὑτος ἦν ἐν ἀρχῇ πρὸς τὸν θεόν. Not a mere repetition of what has been said in John 1:1. There John has said that the Word was in the beginning and also that He was with God: here he indicates that these two characteristics existed contemporaneously. “He was in the beginning with God.” He wishes also to emphasise this in view of what he is about to tell. In the beginning He was with God, afterwards, in time, He came to be with man. His pristine condition must first be grasped, if the grace of what succeeds is to be understood.1
The use of οὗτος immediately draws the previous statement into the meaning, reinforcing the divine nature, not the later, "the Word became flesh," human nature (1:14).
In the beginning was the Word, and the Word was with God, and the Word was God. (ESV)
Most commentators see this is a threefold statement of the same state. In other words, just as Jesus is the same yesterday, today, and tomorrow (Hebrews 13:8); "the Word" is the same as in the beginning. However, as this answer notes, "the word και (and) found at J 1:1 is said by Danker in his Concise Greek concordance to have the sense of “and so.”
In the beginning was the Word, and so the Word was with God and so the Word was God.
This opens the possibility John is referring to three consecutive states which build on one another:

If so, then the first state, unlike the second and third, lacks "God" implying the Word was before God. A reader would likely find support for understanding the Word was "in the beginning before God" in the first state since the second state uses the article to identify God and it is missing in the third, paralleling the LXX use in the Greek Genesis. Taken by itself the Word is superior to God, an understanding which is made impossible by the fourth statement using the pronoun οὗτος. Yet, while removing any implication of the superiority of the Word, οὗτος preserves the equality of the Word and God from the first three statements.
Conclusion
The best translation for οὗτος is "this" which supports all of the uses of ὁ λόγος and specifically places the Word and God together in the beginning:
ἐν ἀρχῇ ἦν ὁ λόγος...οὗτος ἦν ἐν ἀρχῇ πρὸς τὸν θεόν
In the beginning was the Word...this was in the beginning with God.
Thus it provides what is missing before the first "and so" such that it (re)unites God, who was grammatically "missing" from the Word "in the beginning." It establishes a type of inclusio with the opening "In the beginning..." to show the Word while separate from God, was equal to God, including an eternal nature.
- Expositor's Greek Testament