Pauli matrices as measurement operators I am trying to understand a paper on the Bell test experiments. I understand that if we wanted to measure the spin of a spin-1/2 particle in state $\psi$ along the z-axis we would apply the operator  $$\sigma_z=
\begin{pmatrix}
  1&0\\0&-1
\end{pmatrix}$$ and to measure along the x-axis we would use $$ \sigma_x =
\begin{pmatrix}
   0&1 \\ 1&0
\end{pmatrix}.$$
But if, given an ensemble of spin-1/2 particles we wanted to measure spin along either the x-axis or z-axis in random alteration, how would we construct the relevant measurement operator? 
What about if we wanted to measure, again choosing randomly, spin either along the line 45 degrees between the positive x and z axes, or along the line 45 degrees between the negative x and positive z axes? What is the operator in this case?
The paper I am reading assumes the reader is already familiar with such details.
 A: If you want to measure the spin projection of a spin-$\tfrac12$ particle along a particular direction $\vec n$ in space (where $\|\vec n\|^2=1$), the most convenient way is to define the Pauli matrices in some specific coordinate system - so, conventionally,
$$
\sigma_x=\begin{pmatrix}0&1\\1&0\end{pmatrix},\quad
\sigma_y=\begin{pmatrix}0&-i\\i&0\end{pmatrix}\quad\text{and}\quad
\sigma_z=\begin{pmatrix}1&0\\0&-1\end{pmatrix},
$$
normalized to $[\sigma_i,\sigma_j]=2i\varepsilon_{ijk}\sigma_k$, in the $\sigma_z$ eigenbasis - and to take the dot product of your vector $\vec n=(n_x,n_y,n_z)$ with the Pauli matrix vector $\vec\sigma=(\sigma_x,\sigma_y,\sigma_z)$ (i.e. a vector whose components are operators, same as momentum) to get
$$
\sigma_\vec n=\vec n\cdot\vec\sigma=n_x\sigma_x+n_y\sigma_y+n_z\sigma_z=\begin{pmatrix}
n_z&n_x-in_y\\n_x+in_y & -n_z
\end{pmatrix}.
$$
This operator represents the angular momentum projection along the $\vec n$ axis. It has two eigenvectors, which I'll denote $|\vec n\rangle$ and $|-\vec n\rangle$, with well defined positive and negative spin along this axis, respectively. 
If your vector has spherical coordinates $(\theta, \phi)$, then these eigenvectors will have those exact same coordinates, and its antipode, on the Bloch sphere. In the $\sigma_z$ basis they can be represented as
$$|\vec n\rangle=\cos(\theta/2)|\uparrow\rangle+e^{i\phi}\sin(\theta/2)|\downarrow\rangle$$
and its orthogonal complement, where $\vec n=(\sin(\theta)\cos(\phi),\sin(\theta)\sin(\phi),\cos(\phi))$. It is a good exercise to prove that these are indeed eigenvectors.
In terms of the eigenvectors, then, the projectors - which give the probabilities a measurement will yield the $+\vec n$ or $-\vec n$ directions, are $|\vec n\rangle\langle\vec n|$ and $|-\vec n\rangle\langle-\vec n|$, respectively.
If this looks a bit complicated, don't worry too much and just plunge into the calculations. If $\vec n$ is simple - like your 45° polarizations - so will your operators, projectors and eigenvectors.

I'm less clear about what you're really asking in your second question. If you're choosing measurements randomly, you need to be really careful about what you mean. If for each run I randomly choose the measurement axis to be $x$ or $z$, then the corresponding operator will be $\sigma_x$ or $\sigma_z$. 
In my ledger I will (or at least I can, in principle) record the measurement axis and the outcome. The probabilities for each outcome will be the expectation values of the corresponding projectors: getting $+$ on a $z$ measurement has probability $\langle\psi|\uparrow\rangle\langle\uparrow{}|\psi\rangle$, getting $-$ on an $x$ measurement has probability $\langle\psi|-\rangle\langle-|\psi\rangle$, and so on.
The situation does change, or course, if you start "forgetting" some of those values. You might, for example, point your measurement along the positive $x$ or positive $z$ axes (randomly, with probabilities $p_x$ and $p_z$), but only record the outcome. In this case you can only ask for the probability of getting a $+$ or a $-$ outcome. The first, for example, is given by
$$
p(+)=p_z\langle\psi|\uparrow\rangle\langle\uparrow|\psi\rangle+p_x\langle\psi|+\rangle\langle+|\psi\rangle.
$$
You can then consider a single measurement operator by factorizing the state as
$$
p(+)=\langle\psi|\left(\vphantom{\sum}p_z|\uparrow\rangle\langle\uparrow|+p_x|+\rangle\langle+|\right)|\psi\rangle
=\langle\psi|\hat P|\psi\rangle.
$$
However, $\hat P$ is not a well-behaved measurement projector, as it does not obey $\hat P^2=\hat P$. This can meaningfully be used to describe, for example, imperfect measurements, but I would advise you to leave such matters alone for now.
A: To understand the spin 1/2 particles, you just need to represent their state as a point in or on a sphere in the ordinary 3-dimensional Euclidean space. Indeed this is the space generated by the Pauli matrices.
Points on the sphere are "pure states" (or zero-entropy states), while those inside the sphere are impure states.
When measuring the spin in a given direction, the result has a probability directly given by the component of the point in that direction: taking the 2 planes parallel to each other and tangent to the sphere, orthogonal to the given direction, mark one place with value 0 and the other with value 1. A point in the sphere has then a value between 0 and 1, of how far it is from the plane with value 0. This is the probability to get one of both possible results of the measurement.
See more details in my introduction to quantum physics.
