Help understanding the code
In order to do fractional integer math in C (and other languages that don't support fractional math), it's necessary to pull tricks like this. What you would really like to do is to multiply two 16-bit numbers and keep the high bits of the product. 

The first set of expressions cast 16-bit numbers into signed 32-bit numbers, then calculate the 32-bit product. They then shift it right by 15 bits, discarding the least significant bits. It's a bit like what goes on with floating point math when you multiply two mantissas (though the floating point math would be done more efficiently since there's no need to calculate what will be discarded). 

In the second expression (polecount++ == POLEPAIRS) has a boolean value based on the comparison of the value of the variable polecount to POLEPAIRS. The variable polecount is post-incremented (incremented after the comparison).