Buildings are impassable to all models except for infantry, and only one unit may occupy a building at a time. The maximum unit strength of a unit that can occupy a building is 30 - units larger than this may not enter a building.
If an infantry unit moves into contact with a building, it may enter it, though it cannot do this in the same turn that it marches or reforms. Place a representative model from the unit in, on or next to the building to remind you that the unit is inside (standard bearers are the best at this!), and place the rest of the unit aside from the battlefield.
To leave the building, use the same rules as a unit that re-enters the table after pursuing off the table simply place the unit back on the table in the same formation it was in when it entered the building and with its rear rank in contact with any point of the building, and then make a normal move (remember, they cannot charge or march).
Once it enters a building, the unit is assumed to disperse as individual soldiers take up positions at windows and doorways, and spread through its storeys. As such, a unit in a building has no ranks, no flanks and no rear.
In almost all respects, it is best to think of the unit now occupying the space that is represented by the building model - its walls are the edges of the unit. All distances relevant to the unit (for Psychology effects, spells, missile fire, etc) are measured to and from the building itself.
Note that characters that count as infantry may leave or join a unit that is occupying a building (and vice versa) by simply entering or leaving the building as described above. The characters and the unit still count as a single unit occupying the building, as normal for characters joining units (their combined unit strength must still not exceed 30!).