What's with the very slightly larger mass of the neutron compared to the proton?
Masses and coupling between quarks are free parameters in the standard model, so there is not real explanation to that fact.
About the measurment: you can have a look at this wikipedia article about Penning traps which are devices used for precision measurements for nucleus. Through the cyclotron frequency (Larmor factor) we can obtain the mass of the particle.
Edit: "A neutron is a proton + an electron" is a common answer to this question, but it is a totally invalid reasoning.
Both protons and neutrons are made of three quarks. The mass of the quarks is not known with enough precision, and even more important (and that's a why for the masses of the quarks), the interaction between them is responsible for the mass value to a much larger extend.
A proton is made of two up quarks and a down quark, whereas a neutron is made of two down quarks and an up quark. The quark masses contribute very little of the actual mass of the proton and neutron, which mostly arises from energy associated with the strong interactions among the quarks. Still, they do contribute a small fraction, and the down quark is slightly heavier than the up quark, which approximately accounts for the difference. (The masses of the up and down quarks, because they're so small, are not extremely well-measured, and detailed calculations of what the proton and neutron masses would be for given quark masses are difficult. So it's hard to be quantitative about the answer in a precise way.)
You can read a bit about the state of the art in calculations of the proton mass here: http://news.sciencemag.org/sciencenow/2008/11/21-02.html
A recent paper [1] has computed the mass difference ab initio from the theory, using a technique know as lattice, where one writes the equations on a discretised spacetime (this is conceptually similar to what engineers do with finite elements method to study how a beam of metal flexes for example). They took into account
- the contributions of electromagnetism and of the strong interaction,
- the difference of mass between up and down quarks,
- up, down, strange, and charm in the quark sea [*],
Their result is
$$m_n-m_p = 1.51(16)(23) \text{MeV},$$
to be compared with the experimental value,
$$m_n - m_p = 1.29,$$
with an error orders of magnitude smaller. This is pretty impressive: an accuracy of 390 keV, and according to the paper a proof that $m_n > m_p$ at the level of 5 standard deviations. Again, ab initio, just from the Standard Model.
The authors of that paper also give the respective contributions of electromagnetism and of the strong interaction. This is very interesting as the electrostatic energy, just based on the quark charges, would naively be thought to be negative for the neutron but zero for the proton, on average [**]. Their result is that
- $(m_n-m_p)_\text{QCD}=2.52(17)(24)$ MeV,
- $(m_n-m_p)_\text{QED}=-1.00(07)(14)$ MeV,
where QCD stands for Quantum ChromoDynamics, our best theory of the strong interaction, and QED for Quantum ElectroDynamics, our best theory of electromagnetism. So indeed, the different of electrostatic energy is in the intuitive direction I have just highlighted above. This is compensated by the contribution of the strong interaction which goes in the other direction. I don't have an intuitive reason for that to share.
[*] Protons and neutrons are made of 3 so-called valence quarks, but also of a "soup" of other quarks-antiquark pairs which is called the sea.
[**] The sum of the product of the charges are $\frac{2}{3}\frac{2}{3} + \frac{2}{3}\frac{-1}{3}+ \frac{2}{3}\frac{-1}{3}=0$ for the proton but $\frac{2}{3}\frac{-1}{3} + \frac{2}{3}\frac{-1}{3}+ \frac{-1}{3}\frac{-1}{3}=-\frac{1}{3}$ for the neutron.
[1] Sz. Borsanyi, S. Durr, Z. Fodor, C. Hoelbling, S. D. Katz, S. Krieg, L. Lellouch, T. Lippert, A. Portelli, K. K. Szabo, and B. C. Toth. Ab initio calculation of the neutron-proton mass difference. Science, 347(6229):1452–1455, 2015. arxiv.org/abs/1406.4088