Could you please stop shuffling the deck and play already?

JavaScript (ES6), 44 bytes

Shorter version suggested by @nwellnhof

Expects a deck with 1-indexed cards as input.

f=(a,x=1)=>a[x]-2&&1+f(a,x*2%(a.length-1|1))

Try it online!

Given a deck \$[c_0,\ldots,c_{L-1}]\$ of length \$L\$, we define:

$$x_n=\begin{cases} 2^n\bmod L&\text{if }L\text{ is odd}\\ 2^n\bmod (L-1)&\text{if }L\text{ is even}\\ \end{cases}$$

And we look for \$n\$ such that \$c_{x_n}=2\$.


JavaScript (ES6),  57 52  50 bytes

Expects a deck with 0-indexed cards as input.

f=(a,x=1,k=a.length-1|1)=>a[1]-x%k&&1+f(a,x*-~k/2)

Try it online!

How?

Since JS is lacking native support for extracting array slices with a custom stepping, simulating the entire riffle-shuffle would probably be rather costly (but to be honest, I didn't even try). However, the solution can also be found by just looking at the 2nd card and the total number of cards in the deck.

Given a deck of length \$L\$, this code looks for \$n\$ such that:

$$c_2\equiv\left(\frac{k+1}{2}\right)^n\pmod k$$

where \$c_2\$ is the second card and \$k\$ is defined as:

$$k=\begin{cases} L&\text{if }L\text{ is odd}\\ L-1&\text{if }L\text{ is even}\\ \end{cases}$$


Python 2, 39 bytes

f=lambda x:x[1]-2and-~f(x[::2]+x[1::2])

Try it online!

-4 thanks to Jonathan Allan.


Jelly, 8 bytes

ŒœẎ$ƬiṢ’

Try it online!

How?

ŒœẎ$ƬiṢ’ - Link: list of integers A
    Ƭ    - collect up until results are no longer unique...
   $     -   last two links as a monad:
Œœ       -     odds & evens i.e. [a,b,c,d,...] -> [[a,c,...],[b,d,...]]
  Ẏ      -     tighten                         -> [a,c,...,b,d,...]
     Ṣ   - sort A
    i    - first (1-indexed) index of sorted A in collected shuffles
      ’  - decrement