Setting pins as output Code - micro-controller
I'm not familiar with that variety of microcontroller but the standard is to use a zero base for the pin numbering and the binary pattern is a one to one mapping to the pins.

Pin   76543210
PxIE  00000010b // = 0x02 Pin 1 is enabled.


The |= operator is bitwise inclusive OR and assignment operator.  C |= 2 is same as C = C | 2. So in your example,

P1IE |= 0x02


is the same as

P1IE = P1IE | 0x02


and if P1IE = 8, for example then adding

P1IE = 00001000b
0x02 = 00000010b
       ---------
       00001010b = 0x0A = 10 (decimal)


See C++ operators.



From comment:


  Why do we use 0x02?


0x02 = 10b so that enables the second pin, pin 1.


  How does 00001010b mean its enabled.. it says that a binary value of 1 means it enabled how does 00001010b = 1


It doesn't. The syntax in your question means that pin 1 is enabled along with whatever pins are alread enabled.

// Another example
// Bits   76543210
// P1IE = 01101000b // Bits 6, 5 and 3 are already set.
// We now want to set bit 1 as well
//        00000010b = 0x02 


We can do this without knowing what bits are already set by using the "bitwise inclusive OR" operator.

 P1IE |= 0x02               // One way of doing it.
 P1IE |= 0x00000010b        // Another way.
 P1IE = P1IE | 0x00000010b  // Another way.