Q:

Use of shift statement in the script

I was going through a bash script and wanted to understand below piece, mainly the shift statement...what actually it's doing? 
while [ $# -gt 0 ]; do
    case "$1" in
        --mirror)
            mirror="$2"
            shift
            ;;
        --dry-run)
            DRY_RUN=1
            ;;
        --*)
            echo "Illegal option $1"
            ;;
    esac
    shift $(( $# > 0 ?  1 : 0 ))
done

A:

The arguments to the script come in the positional parameters, $1, $2, ... shift drops the first one, and moves the rest to the left.  So if the arguments are foo, bar, doo, after a shift they'll be bar, doo.  An argument to shift tells how many steps shift, shift without an argument is the same as shift 1. 
The usual form of a loop like this is something like this:
while [ $# -gt 0 ]; do 
    # work with $1...
    shift
done

The loop goes on as long as there are arguments, $# contains their number.  Each iteration of the loop looks at the first argument, and the final shift removes it and moves to the next one. 
In your code, the final shift takes a conditional argument, $(( $# > 0 ?  1 : 0 )) is 1 as long as $# is greater than 0, i.e. if there are any arguments left; and 0 if there aren't.  Usually, that would resolve to just 1, since, well, we just checked the same thing before going to the loop. 
But if the script got --mirror as the final argument, the shift in the branch for --mirror would remove it, and there'd be none left.  A subsequent shift 1 would return with a failure.  The condition here avoids that.  Not that the error would matter, unless the script runs with set -e, which would check each and every command for failure.