What is the basis for the Apostles devoting themselves to prayer for nine days in Acts 1:14? We know that in Acts the Apostles prayed in the upper room consecutively until the Holy Spirit descended on them. Oftentimes I heard that this was calculated to be for nine days. How did people reach this number?
The existing answers give much valuable and interesting information. This is just to indicate, as asked, how the number of days is actually calculated.

Leviticus 23 16 gives the date of the Jewish Festival of Pentecost as occurring fifty days after the Passover Sabbath. On the basis that the Jewish Passover began on the evening of Good Friday then Pentecost was the Sunday 7 weeks after Easter Day, 

This question on the Judaism stack exchange has more about this.

Acts 1 verse 3 tells us that the risen Jesus was seen by His apostles for a period of forty days. Beginning on Easter Sunday, as the first day, we get that the fortieth day was a Thursday, which the Church celebrates as Ascension Day. (In practice it is often celebrated on the following Sunday for convenience.)  

Acts 2 verse 1 tells us that the Holy Spirit came on the Day of Pentecost, that is on the Sunday ten days after the Ascension of Christ. This is why Whit Sunday, or  Christian Pentecost, is always exactly 7 weeks after Easter Day. 

This leaves the intervening days between Ascension Day and Whit Sunday on which the apostles prayed, as the Friday and Saturday after the Ascension and the whole of the following week, that is nine days in all.