Why is $AUC=0.5$ and a 45-degree line for a ROC curve considered baseline performance? $AUC=0.5$ and an ROC curve of a 45-degree line often are considered the baseline performance of a model, one that gets absolutely nothing from the features.
If we predict the same (prior) probability of class membership every time, how do we wind up with a 45-degree line for the ROC curve? Either we get perfect sensitivity and zero specificity, or we get zero sensitivity and perfect specificity. The 45-degree line implies that a sensitivity of $0.4$ is possible when the specificity is $0.6$.
How does that happen?
And why, with the ROC curve being so funky, do we say that $AUC=0.5$ is the baseline performance? Is this related to how AUC is related to the Wilcoxon test (Harrell’s concordance index) and not just the geometry of the ROC curve?

The following minimal example might help.
First, we build the most frequent class classifier from small toy data with the prevalent positive class (`True') having 66.6% probability. We then apply it to an even smaller test dataset, predicting the same probability of 66.6% for each instance.
y_train=[True,True,False,True,True,False]
# get the probability of the positive class
# we will use this as a prediction for all test instances
pos_probability=sum(y_train)/len(y_train) 
y_test=[False,True,True]
y_pred_prob = [pos_probability for i in range(0,len(y_test))] 

Next, we get the values of false positive rate and true positive rate used as an input for the ROC curve.
from sklearn.metrics import roc_curve
fpr, tpr, thresholds = roc_curve(y_test, y_pred_prob, pos_label=True)

Finally, we plot the curve:
from sklearn.metrics import RocCurveDisplay
roc_display = RocCurveDisplay(fpr=fpr, tpr=tpr).plot()


How do we wind up with a 45-degree line for the ROC curve?
This follows from the input data for the ROC plot.
The output of fpr is [0., 1.]
The output of tpr is [0., 1.]
The ROC plot is created by connecting only these two points ([0,0] and [1,1]) with a straight line.
Why don't we get more points?
The reason for this is that the value of the false positive rate and of the true positive rate (almost) do not react to changes in the threshold, which is used to create the input for the ROC curve. In our case, the output of thresholds is [1.66666667, 0.66666667]
The first threshold is arbitrarily set in scikit-learn above 1.0 to ensure that no instances get predicted as positive. The second threshold corresponds in our case to the value of `pos_probability'.
Recall that $tpr=\frac{tp}{positives}$ and  $fpr=\frac{fp}{negatives}$ for a given threshold value.
Since these relative values are used for axes, it does not matter how many positives or negatives (absolute) are in the dataset.
