There are many ways to attach things to brick, but the easiest and most common is to use plastic wall plugs.
These are an expansion-style anchor that require you to pre-drill a hole in the brick using a masonry bit of the correct size as defined by the plug manufacturer. They are designed in a way that a screw driven into the plug forces the plug to expand outwards, anchoring everything in place with friction.
There are also more heavy-duty anchors such as these AnkaScrews and DynaBolts which are used when higher strength connections are required. - JacobZ
The easiest to use which are my "go-to" fasteners are these Ramset multipurpose anchors which I used to hang a dryer on a brick wall for a client. Each fastener has a holding strength of 32kgs.
The most important consideration is that we want to align as many anchors in brick and not the soft mortar. The holes should be around 20mm in from an edge to avoid the brick possible breaking/cracking during the drilling process. - Nailbag
For larger items I propose using the Ramset 300ml Chemset UltraFix Plus in combination with Ramset M10 x 130mm Galvanised Chemset Stud. This anchoring system does not put any stress on the bricks when compared to Dynabolts or steel expansion anchoring systems. – EricL
Construction adhesive will go a long way towards permanently securing light-weight items to brick walls. However, it’s generally best to use mechanical fixings as well, just to make sure the item stays put even if the adhesive bond weakens over time.
For a solid installation, drill into the wall at several points along where the item will sit, insert plastic wall plugs, then screw through the item into the plugs. These STAHL masonry kits are a real timesaver, as they include the drill bit, correctly sized plug and fixing screws. – MitchellMc