How does one mine a fraction of a bitcoin?
You either mine a full block...

-> Then you're free to take the full 12.5 BTC reward or less, at your choice.

Or..

-> You can mine with a pool. Everyone in that pool calculate hashes of trivial amounts, but their sum will be enough to mine blocks. Then, the pool will reward your work. (Search for PPS or PPLNS)