Why was it necessary for some people to receive the Gift of the Holy Ghost by the laying on of hands and others just received it after believing? Some people never received the gift of the Holy Ghost until Paul gave it to them through the laying on of hands. Others it appears received it just by believing or at least it is not mentioned that they had hands laid upon them first. Is there a difference between the two types of receiving the Holy Ghost?

Acts 19:5 When they heard this, they were baptized in the name of the Lord Jesus.
6 And when Paul had laid his hands upon them, the Holy Ghost came on them; and they spake with tongues, and prophesied.
Acts 8:15 Who, when they were come down, prayed for them, that they might receive the Holy Ghost:
16 (For as yet he was fallen upon none of them: only they were baptized in the name of the Lord Jesus.)
17 Then laid they their hands on them, and they received the Holy Ghost.
18 And when Simon saw that through laying on of the apostles’ hands the Holy Ghost was given, he offered them money,

The author states that &quot;through laying on of the apostles’ hands the Holy Ghost was given&quot;. This gives us an answer as to how some people received the Holy Ghost. Why did others receive it in some other way? Is there a difference between the Holy Ghost as it was given by Paul (through the laying on of hands), and the spirit felt by the people in the other circumstances? Both came from God, but were received differently.
The first verses you cite (Acts 19:5-6) do not teach what we today call being "baptized into Christ Jesus" (Romans 6:3; Galatians 3:27) or being "baptized by one Spirit into one body" (1 Corinthians 12:13). We can safely conclude the Ephesian believers were already baptized into Christ Jesus, or were baptized by one Spirit into one body (i.e., the body of Christ, the church universal). 

In other words, they were already indwelt by the Holy Spirit, as Jesus Himself promised in John 15, where He said the Holy Spirit would in Jesus' absence abide with His disciples and be in them (v.17). These new Ephesian believers, however, evidently needed confirmation of that reality through the gifts of speaking in tongues and prophesying. 

Remember, during the events recorded in the book of Acts, God had not yet given the various truths and teachings about the Holy Spirit in all their fullness to the writers of the New Testament canon of Scripture. We might think of the book of Acts as a transitional book, linking Jesus' promise of the coming Holy Spirit (again, John 14) prior to His ascension into heaven, to the authoritative doctrinal teaching on both the Holy Spirit's indwelling of all new believers and His gifting of all believers with one or more spiritual gifts (see 1 Corinthians 12; Romans 12; Ephesians 4; and 1 Peter 4). 

The second verses you cite (Acts 8:15-17) are more germane to your questions, because these verses seem to indicate the Samaritan believers actually received the Holy Spirit's indwelling when the apostles Peter and John prayed for and laid their hands on them. Verse 17 says, 


  "and they [the Samaritan believers] were receiving the Holy Spirit."


In what sense, then, were they "receiving the Holy Spirit"? To answer that question, I again suggest what happens in Acts 8 is an outward demonstration of a truth which was not yet fully understood by the apostles, let alone the Samaritans! That truth is that the Holy Spirit indwells a Christian when he or she first believes, or is passed from death to life, or is born again, or is born from above. Remember, the book of Acts is a transitional book which bridges Christ's teaching on the Holy Spirit and the yet-future teaching of the apostles and writers of the New Testament epistles. 

Did the Holy Spirit, then, indwell the Samaritan believers twice? No, but they perhaps needed this praying and laying on of hands by the apostles to grasp what had happened to them after they believed in Jesus Christ and were baptized, in water, in His name. Remember, water baptism marks a believer, but only the baptism of the Holy Spirit makes a believer. Another term for the baptism of the Holy Spirit is, for example, being "sealed [by the Holy Spirit for the day of redemption" (Ephesians 4:30). Second Corinthians 1:22 KJV says,


  "[God] hath also sealed us, and given the earnest of the Spirit in our hearts." 


And 2 Corinthians 5:5 KJV adds a similar thought:


  "Now he that hath wrought us for the selfsame thing [i.e., what is mortal being swallowed up by life] is God, who also hath given unto us the earnest of the Spirit." 


The "earnest" is like a down payment. Just as interested home buyers will give the home sellers a deposit, which is sometimes called "earnest money," as a token of their seriousness (or *earnest*ness) about buying the house, so also does God give us the Holy Spirit as a sort of down payment guaranteeing that He indeed wants us to be with Him in heaven one day. Only then will our salvation be complete in our glorification (see Romans 8:17 and 30; and 2 Thessalonians 1:10).