Why did God want or need a relationship in the first place? I understand that God is all powerful, knowledgeable, and any other attributes you could assign to Him, so why did He need man? He spent endless "time" existing before man. Why create us now?
While Scripture does not explicitly answer this question, we can find helpful answers in well-known statements of theology, which are backed by Scripture. For example, the Westminster Confession answers your question as follows:
“What is the chief end of man? Man’s chief end is to glorify God, and to enjoy him forever.”
The Confession cites the following as supporting Scriptures: Psalm 86; Isaiah 60:21; Romans 11:36; 1 Corinthians 6:20, 10:31; Revelation 4:11; Psalm 16:5-11; Psalm 144:15; Isaiah 12:2; Luke 2:10; Philippians 4:4; Revelation 21:3-4. We agree with the Confession here, and would add that we believe that God desires a relationship with man so He may be glorified (please refer to above Scriptures) and to allow Him to demonstrate all of His perfect attributes to an audience that can appreciate them. In the demonstration of God’s character through these attributes, we come to know and glorify God.
For example, Jeremiah 9:23-24 says:
Notice that God desires us to understand and know Him, and part of this knowledge is in what He does and who He is. If we understand and know someone, we know what they are like, what kind of person they are. God likewise desires a close, intimate relationship with us whereby He can make Himself known.
God even endures the existence of sinful creatures who were prepared for destruction in order to demonstrate His power, wrath and justice. Romans 9:22-24 says:
Of course, this also demonstrates His great love and mercy for us who are called.
So, we see that God desires for us to know Him, to know His character, and to understand Him. We come to know Him as He reveals His personal attributes, including His love, mercy, grace, justice, and wrath. While we may not have a totally clear answer in this life as to why God created us, it’s something to which we can look forward to asking Him in heaven. For our time on this earth, may our Lord God continue to empower us to bring Him glory and honor in everything we do.
As we’re commanded in 1 Corinthians 10:31 - Whether, then, you eat or drink or whatever you do, do all to the glory of God.