One idea is to compute how much is contributed by each bit in the sum. If the array is length $n$ there are $\frac 12n(n+1)$ subarrays because you choose two positions with replacement, with the earlier being the start and the later being the end. For each bit position the OR of a subarray will be $1$ unless all the numbers in it have a $0$ in that location, so we want to count the runs of $0$s. A run of $k\ 0$'s will generate $\frac 12k(k+1)$ subarrays that have a zero in that bit. Add up the number of subarrays that have a $0$ in the position, subtract from the total number of subarrays, and you have the number of subarrays that have a $1$ in that position.
As an example I will use the array $[1,2,3,4,5,6,7,8,9,10]$. There are $\frac 12\cdot 10 \cdot 11=55$ subarrays.
In the ones bit there are five runs of $0$'s, each of length $1$. Each of those contributes one subarray with a $0$ in the ones bit, so there are $50$ subarrays with a $1$ in the ones place, starting our sum with $50$. In the twos bit there is a run of $1$ from $1$, a run of $2$ from $4,5$, and a run of $2$ from $9,10$. These give $1+3+3=7$ subarrays that have a $0$ in the twos bit, so there are $48$ that have a $1$, contributing $96$ to the sum. In the fours bit there is a run of three $0$s to start off and a run of three at the end, so there are $12$ subarrays with a $0$ in the fours place, giving $43$ with a $1$ and contributing $172$ to the sum. Finally for the eights there is a run of $7$ numbers at the start with a $0$ which gives $28$ subarrays with a $0$ in the eights place, so $27$ with a $1$, contributing $216$ to the sum. The sum is then $50+96+172+216=534$
This approach is linear in the length of the array. The operations count also grows with the number of bits in the largest number. If you had a short array with large numbers it would be faster to compute each subarray, which is actually an $n^3$ process-there are about $\frac 12n^2$ subarrays of average length $\frac n2$. If you had a thousand numbers of billions of bits and you can do a bitwise OR as a single operation it would be more efficient to just compute each subarray.