In a large network (one with dedicated routers) there can be more than one network path between two computers. Routers often have multiple network links to each other for redundancy, and so you can send packets over either link to reach the same destination computer.
Anycast exploits this by making it look like there are two or more routes to an IP address, but actually those routes go to completely different computers. If one of the computers goes offline the route will disappear, but the other route will still be available.
It requires some configuration to get working. To share IPs between sites you need to configure BGP (ISP-level routing) and you can only do it for blocks of at least 256 IP addresses (so using anycast for only one IP will waste ~253 IPs). Within a site you still need to configure your routers so they know where to find all the anycast endpoints, and this is typically done by having each endpoint publish its presence while it is online.
Because the endpoints look like multiple paths to the same computer, traffic might randomly use a different path. Normally this isn't a problem (the packets still arrive at the same place even if the path they took changed) but for an anycast IP a different path means a different destination. This means you can be sending traffic to one endpoint and suddenly the packets will arrive on a different endpoint.
For this reason anycast doesn't work with "long lived" protocols and is typically only used with stateless ones. DNS anycast is common because the packets are small and it doesn't matter if the endpoint server changes unexpectedly. Some sites use anycast with HTTP for very small files that can be retrieved in only a packet or two. But anything beyond that becomes unreliable with anycast, as TCP connections will appear to randomly drop out any time the "path" changes.
1What's the point of such narrow q-n if having studied wikipedia's article on anycast matter would have explained anything. Downvote is mine – poige – 2018-02-07T02:27:28.657